kernel/common/module.rb
# Check if a full constant path is defined, e.g. SomeModule::Something
Check if a full constant path is defined, e.g.
Check if a full constant path is defined e . g .
def const_path_defined?(name)
    if name[0,2] == "::" then
      start = Object
      pieces = name[2,(name.length - 2)].split("::")
    else
      start = self
      pieces = name.split("::")
    end
    defined = false
    current = start
    while current and not defined
      const = current
      defined = pieces.all? do |piece|
        if const.is_a?(Module) and const.constants_table.key?(piece)
          const = const.constants_table[piece].value
          true
        end
      end
      current = current.direct_superclass
    end
    return defined
  end
def const_path_defined? ( name ) if name [ 0 , 2 ] == "::" then start = Object pieces = name [ 2 , ( name . length - 2 ) ] . split ( "::" ) else start = self pieces = name . split ( "::" ) end defined = false current = start while current and not defined const = current defined = pieces . all? do | piece | if const . is_a? ( Module ) and const . constants_table . key? ( piece ) const = const . constants_table [ piece ] . value true end end current = current . direct_superclass end return defined end
Check if a full constant path is defined, e.g.
Check if a full constant path is defined e . g .
# Start at Object if this is a fully-qualified path
name
<not_specific>