Skip to content

Instantly share code, notes, and snippets.

@zhengjia
Created August 28, 2010 03:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhengjia/554640 to your computer and use it in GitHub Desktop.
Save zhengjia/554640 to your computer and use it in GitHub Desktop.
def a
puts 'a'
end
ma = method :a
mma=ma.to_proc
mmma = Kernel.send :define_method ,:new_method, &mma
mmma2 = Kernel.send :define_method ,:new_method2, mma
new_method
new_method2
puts mmma # => #<Proc:0x0000000100124d18@untitled:10>
mmma.call
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment