Skip to content

Instantly share code, notes, and snippets.

@taiki45
Created October 31, 2012 13:33
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 taiki45/3987060 to your computer and use it in GitHub Desktop.
Save taiki45/3987060 to your computer and use it in GitHub Desktop.
def pass_env(x = 9)
binding
end
def closure(y = 3)
Proc.new { y }
end
pass_env closure do |cl|
cl.call
end.eval "yield x" #=> 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment