Chapter 10. JRuby and Angular
We live in a beautiful and orderly world, not in a chaos without norms, even though that is how it sometimes appears.
Sorting and filtering are activities that have been used since ancient times to organize the world. Ancient acrostics used each letter in an alphabet to start a line of a poem. This involves both filtering (selection of first letter) and sorting (alphabetical). The Sieve of Eratosthenes, shown in Figure 10-1, can be visualized by writing out, in order, the integers from two to the upper bound in question, and then filtering out composites (nonprime numbers) as the multiples of primes.
A quick search on filtering and sorting returns many results geared toward the manipulation of data in spreadsheet programs. The project in this chapter will show how, with a relatively small amount of code, JRuby and Angular can be used to filter and sort an HTML table containing data from Google Finance stock market data.
Server Side: JRuby and Sinatra
Simple, dynamic web APIs can be created using Ruby and a microframework called Sinatra. Sinatra is essentially a Ruby-based wrapper of HTTP.
Ruby was developed by Yukihiro “Matz” Matsumoto, who incorporated parts of his favorite languages (Perl, Smalltalk, Eiffel, Ada, and Lisp) to create a new language that balanced functional and imperative approaches. Although ...
Get Client-Server Web Apps with JavaScript and Java now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.