From: Kevin Howe Date: 2005-02-13T06:39:58+09:00 Subject: Re: const_defined? and inheritance > > class A > > FOO = 'BAR' > > end > > > > class B < A; end > > > > puts A.const_get(:FOO) # => 'BAR' > > puts A.const_defined?(:FOO) # => true > > puts B.const_get(:FOO) # => 'BAR' > > puts B.const_defined?(:FOO) # => false > > > I think they're just two different operations. The constants a module > can see ("get") is a superset of the constants it's defined. If that were the case then B.const_get(:FOO) would raise an error since B does not define FOO. Instead it inherits it from A, and returns the inherited value of "BAR". But you are probably right in the sense that const_defined? shows only those explicitly set in that particular class. I'll just use constants.include?('FOO') instead. Regards, Kevin