Make your ruby classes Comparable and Enumerable
Something very cool in ruby are mixins. As the word says mixin is a technique to mixed a module into a class using the statement “include”. While including a module is a very large topic I focused on the opportunity to include module defined in the Ruby standard library into your class to take advantages of the methods and abilities that these modules provide. The Comparable module in ruby define methods like < <= == > >= between? . What if I want to achieve is making my class instances comparable so that I can ask to ruby if class_a > class_b. Here an example: <div></div> The Person class include the module Comparable and implements one single method (<=>). This methods is used by the Comparable module to perform the logic of any of the operator that the module provide.In the example I say to the Person class to compare instances through the @name attribute. But we even gain more functionalities. Once that our classes are able to be compared they are also able to be sorted if placed inside an array. Amazing!!!
NorthScale Membase Server is an elastic key-value database that stores
web application data far more efficiently and cost effectively than it
can be stored in a relational database. With NorthScale Membase Server,
organizations can deploy a highly available, cloud-friendly data layer
that expands dynamically as application needs change, delivering
performance exceeding that of any other NoSQL solution. API compatible
with memcached, the de facto standard web caching software, Membase is
easy to use and supported by virtually every programming language and
application framework.
In these days I am really interested in