From: murphy Date: 2007-12-24T20:41:16+09:00 Subject: Re: module_eval change between ruby1.8 & ruby 1.9. Is it intentional ? Frederick Cheung wrote: > Consider this code > > module Foo > end > > def do_stuff_to_foo(&block) > Foo.module_eval &block > end > > do_stuff_to_foo {def greeting; 'hello'; end} > > If you paste this into irb on 1.9 (r14600, compiled a few minutes ago) > the greeting method is not added to Foo, but to the top level. > On 1.8 it's added to Foo, as I would expect. even more strange, this works as expected: module Foo end Foo.module_eval { def greeting; 'hello'; end } Foo.instance_methods # => [:greeting] [murphy]