On Tue, Jul 1, 2014 at 10:50 AM, Addis Aden <addis.aden / gmail.com> wrote:
> Its that easy. Wow, thank you. never heard of the method method :D

:-)

> Seems that the Method than works like a Proc? I guess that the only
> difference is, that a Proc isnt bound to an object ^^

A Proc is a closure which a method is not. A Method only catches self
i.e. the object which will receive the call.  An UnboundMethod does
not even do that.

A closure captures variables from the surrounding scope

$ ruby -e 'x = 9; f = lambda {|y| x + y};p f.call(7)'
16

... which can even be changed:

$ ruby -e 'x = 9; f = lambda {|y| x + y};p f.call(7);x = 100; p f.call(7)'
16
107

Kind regards

robert

-- 
[guy, jim].each {|him| remember.him do |as, often| as.you_can - without end}
http://blog.rubybestpractices.com/