In the context of the Ruby programming language, what is a closure and when do you use one? What are the uses for it in Rails?
Try this link: Understanding Ruby Closures. Another one: Understanding Ruby Blocks, Procs, and Lambdas. In a nutshell, a closure is a function plus a context in which the function is called. The context contains state information that the function can access, but which isn't part of the function itself. Ruby has several different kinds of closures: blocks, procs, and lambdas.
Also (from Michael): http://www.skorks.com/2010/05/closures-a-simple-explanation-using-ruby/
protected by gnat Apr 14 '15 at 19:26
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site.
Would you like to answer one of these unanswered questions instead?