Skip to content

Instantly share code, notes, and snippets.

@iain
Created January 9, 2014 22:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iain/8343118 to your computer and use it in GitHub Desktop.
Save iain/8343118 to your computer and use it in GitHub Desktop.
instance_eval passes the context as an argument too
class Foo
def call(&block)
instance_eval(&block)
end
end
foo = Foo.new
foo.call do |x|
p x == foo == self # true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment