Skip to content

Instantly share code, notes, and snippets.

@bil-bas
Created July 4, 2012 19:12
Show Gist options
  • Save bil-bas/3049003 to your computer and use it in GitHub Desktop.
Save bil-bas/3049003 to your computer and use it in GitHub Desktop.
programatically define a method that accepts a block
class Test
def self.define_me_a_method(name)
self.send(:define_method, name, proc { |&block|
block.call
})
end
define_me_a_method 'awesome'
end
puts Test.new.awesome do
'hello'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment