Issue #7414 has been updated by benolee (Ben Holley).


I have been working on a patch, but I have some questions about expected behavior.

In the case when the parent is missing, for example:

    # Foo is missing
    Object.const_defined?("Foo::Bar")

should it return false? Or raise NameError for "Foo"? Or call Object.const_missing(:Foo)?

Second, in the case when the parent is not a Module or Class, for example:

    Foo = Object.new
    Object.const_defined?("Foo::Bar")

should it return false? Or raise error "Foo is not a class/module"?

----------------------------------------
Feature #7414: Now that const_get supports "Foo::Bar" syntax, so should const_defined?.
https://bugs.ruby-lang.org/issues/7414#change-34808

Author: robertgleeson (Robert Gleeson)
Status: Assigned
Priority: Normal
Assignee: tenderlovemaking (Aaron Patterson)
Category: 
Target version: 2.0.0


class Foo
end
Object.const_get "Object::Foo" => Foo
Object.const_defined? "Object::Foo" => NameError (expected true).


-- 
http://bugs.ruby-lang.org/