Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module Test
- class Tester
- def takes_a_block
- yield "world"
- end
- def make_the_method
- m = method(:takes_a_block)
- self.class.class_eval do
- define_method "hello", m
- end
- end
- end
- end
- t = Test::Tester.new
- t.make_the_method
- t.hello {|a| puts "hello #{a}"}
Add Comment
Please, Sign In to add comment