Sunday, December 1, 2013

Module extensions 1.9 and 2.0

I did not know that this threw TypeError on 1.9 but passes for 2.0

x = Module.new { def foo; end } 
Module.new { define_method :bar, x.instance_method(:foo) }

From Rails !

No comments: