Monday, May 2, 2011

Understanding Ruby Blocks, Procs and Lambdas

Blocks, Procs and lambdas (referred to as closures in Computer Science) are one of the most powerful aspects of Ruby, and also one of the most misunderstood. This is probably because Ruby handles closures in a rather unique way. Making things more complicated is that Ruby has four different ways of using closures, each of which is a tad bit different, and sometimes nonsensical. There are quite a few sites with some very good information about how closures work within Ruby.

http://www.robertsosinski.com/2008/12/21/understanding-ruby-blocks-procs-and-lambdas/

No comments: