Created
August 29, 2012 15:00
-
-
Save txus/3513917 to your computer and use it in GitHub Desktop.
Kernel#let to the ruby core!!!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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