Skip to content

Instantly share code, notes, and snippets.

@jasoncale
Created February 4, 2009 21:58
Show Gist options
  • Save jasoncale/58366 to your computer and use it in GitHub Desktop.
Save jasoncale/58366 to your computer and use it in GitHub Desktop.
#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