From: Mike Sandler Date: 2007-04-10T02:37:17+09:00 Subject: method defined in module doesn't have access to Constant in class it is imported into ------=_Part_6522_16615151.1176140234472 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Does anyone know why a method defined in a module that is then included in a class does not have access to the constants of that class? Doesn't including the module make all its methods into instance methods of the class? Shouldn't get_foo and class_get_foo in the following example work the same? module ModFoo def get_foo FOO end end class Foo FOO = 'this is foo' include ModFoo def class_get_foo FOO end end f = Foo.new f.get_foo >> f.get_foo NameError: uninitialized constant ModFoo::FOO from (irb):3:in `get_foo' from (irb):11 from :0 f.class_get_foo => "this is foo" ------=_Part_6522_16615151.1176140234472--