Skip to content

Instantly share code, notes, and snippets.

@rauchy
Created November 24, 2012 13:50
Show Gist options
  • Save rauchy/4139760 to your computer and use it in GitHub Desktop.
Save rauchy/4139760 to your computer and use it in GitHub Desktop.
Blocks In-depth: Closures
def greet
"Hello, #{yield}!"
end
name = "Omer"
greet { name } # => "Hello, Omer!"
def puts_x(some_bindings)
eval("puts x", some_bindings)
end
x = "Yo!"
puts_x(binding)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment