Skip to content

Instantly share code, notes, and snippets.

@caius
Created August 29, 2011 01:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save caius/1177516 to your computer and use it in GitHub Desktop.
Save caius/1177516 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