Skip to content

Instantly share code, notes, and snippets.

@deepak
Created July 25, 2013 07:13
Show Gist options
  • Select an option

  • Save deepak/6077501 to your computer and use it in GitHub Desktop.

Select an option

Save deepak/6077501 to your computer and use it in GitHub Desktop.
define method with a block
def new_method name, &block
define_method(name) { block.call }
end
new_method :ping do
puts "pong"
end
ping
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment