By Jeff Kreeftmeijer on 2011-11-28 Method chaining is a convenient way to build up complex queries, which are then lazily executed when needed. Within the chain, a single object is updated and passed from one method to the next, until it’s finally transformed into its output value. Object-relational mappers like Rails’ ActiveRecord use method chaining in their query interfaces to build up a databa
![Method chaining and lazy evaluation in Ruby](https://cdn-ak-scissors.b.st-hatena.com/image/square/12e0a5a30c1ed3477925cb98e2a951153cf38d17/height=288;version=1;width=512/https%3A%2F%2Fjeffkreeftmeijer.com%2Fruby-method-chaining%2F3600x1800.png)