Hi,
I just discovered a behavior of ruby that seems strange to me.
I have a module containing classes, and i'd like those classes to be
able to call some method of the module, so i tried different solutions :
module Foo
def self.bar
puts "bar!"
end
bar # works
class Baz
# bar # doesn't work
# self.bar # doesn't work
Foo.bar # need to know the module name
end
end
I'd like to be able to call the method from Foo::Baz without knowing the
name of the module, but the only way i found is to call Foo.bar from
inside Baz.
Now if you replace "module Foo end" by "Module.new.module_eval {}"...
Shouldn't ruby walk the nesting stack when it doesn't find a method name ?
Is this going to change in 2.0 ?
Cheers,
Yoann