kernel/common/autoload19.rb
##
# When any code that finds a constant sees an instance of Autoload as its match,
# it calls this method on us
When any code that finds a constant sees an instance of Autoload as its match,
it calls this method on us
When any code that finds a constant sees an instance of Autoload as its match it calls this method on us
def find_const
    current, constant = @scope, undefined
    while current
      constant = current.constant_table.fetch name, undefined
      unless constant.equal?(undefined)
        if constant.equal? self
          constant = Object.constant_table.fetch name, undefined
          if constant.equal?(undefined)
            return scope.const_missing(name)
          end
        end
        return constant
      end
      current = current.direct_superclass
    end
    if instance_of?(Module)
      constant = Object.constant_table.fetch name, undefined
      unless constant.equal?(undefined)
        if constant.equal? self
          return scope.const_missing(name)
        end
        return constant
      end
    end
    scope.const_missing(name)
  end
def find_const current , constant = @scope , undefined while current constant = current . constant_table . fetch name , undefined unless constant . equal? ( undefined ) if constant . equal? self constant = Object . constant_table . fetch name , undefined if constant . equal? ( undefined ) return scope . const_missing ( name ) end end return constant end current = current . direct_superclass end if instance_of? ( Module ) constant = Object . constant_table . fetch name , undefined unless constant . equal? ( undefined ) if constant . equal? self return scope . const_missing ( name ) end return constant end end scope . const_missing ( name ) end
When any code that finds a constant sees an instance of Autoload as its match,
it calls this method on us
When any code that finds a constant sees an instance of Autoload as its match it calls this method on us