Skip to content

Instantly share code, notes, and snippets.

@seanlilmateus
Forked from caius/gist:1177516
Created August 29, 2011 17:34
Show Gist options
  • Save seanlilmateus/1178900 to your computer and use it in GitHub Desktop.
Save seanlilmateus/1178900 to your computer and use it in GitHub Desktop.
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