Skip to content

Instantly share code, notes, and snippets.

@txus
Created August 29, 2012 15:00
Show Gist options
  • Save txus/3513917 to your computer and use it in GitHub Desktop.
Save txus/3513917 to your computer and use it in GitHub Desktop.
Kernel#let to the ruby core!!!
# Wouldn't you love this in Ruby? I would! :D
module Kernel
def let(bindings, &block)
block.call *bindings
end
end
msg = let [33, 'Lincoln'] do |age, name|
"I am #{name} and I am #{age} years old."
end
puts msg
# outputs "I am Lincoln and I am 33 years old."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment