From: Joel VanderWerf Date: 2005-02-13T06:50:15+09:00 Subject: Re: const_defined? and inheritance Kevin Howe wrote: >>> 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 An alternative: p defined?(B::FOO) # ==> "constant" But this will include more than just the constants defined by A and B: p defined?(B::Object) # ==> "constant"