On Sat, Jan 22, 2011 at 4:12 AM, Josh Cheek <josh.cheek / gmail.com> wrote:
> def show_error(f)
>  ®> rescue => e
>  
> end
>
> f = lambda { x }
> show_error f # => #<NameError: undefined local variable or method `x' for
> main:Object>
>
> x = 1
> show_error f # => #<NameError: undefined local variable or method `x' for
> main:Object>
>
> g = lambda { x }
> show_error g # => 1


After doing the above, try this.

def x
  "Anything returned by the (Receiver).x method"
end

show_error f # => "Anything returned by the (Receiver).x method"
show_error g # => 1

At compile time...
f = lambda { x }
x is not defined, and is thought to be a method!

Look...
http://www.ruby-forum.com/topic/724184

Abinoam Jr.