Created
February 4, 2009 21:58
-
-
Save jasoncale/58366 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
#some method I didn't write | |
def some_method_that_needs_a_block(*args, &block) | |
#something in that calls the passed block | |
block.call(args) | |
end | |
#my methods .. | |
def my_method(*args, &block) | |
some_method_that_needs_a_block(args, block) | |
end | |
my_method("hello") do |msg| | |
puts "you said #{msg}" | |
end | |
#=> says the message duh .. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment