Skip to content

Instantly share code, notes, and snippets.

@cheald
Created November 23, 2012 08:41
Show Gist options
  • Select an option

  • Save cheald/4134560 to your computer and use it in GitHub Desktop.

Select an option

Save cheald/4134560 to your computer and use it in GitHub Desktop.
class Foo
def value
"Value"
end
def eval_stuff
instance_eval &(Proc.new { puts value })
instance_eval &(Proc.new {|foo| puts foo.value })
instance_eval &(lambda {|x| puts x.value })
instance_eval &(lambda {|x| puts value })
end
end
Foo.new.eval_stuff
% ruby foo.rb
Value
Value
Value
Value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment