-
-
Save seanlilmateus/1178900 to your computer and use it in GitHub Desktop.
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
george = lambda do | |
puts "george" | |
end | |
def fred | |
puts "fred" | |
end | |
def fire | |
yield | |
end | |
def water obj | |
yield(obj) | |
end | |
def rach arg | |
p "rach: #{arg.inspect}" | |
end | |
fire &george | |
# >> george | |
fire &method(:fred) | |
# >> fred | |
water :fire, &method(:rach) | |
# >> "rach: :fire" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment