Just a remark about this comment:

     "Load stdlib classes even though SimpleDelegator inherits from
BasicObject."

The purpose of that const_get is to load top-level constants (which belong
to Object), regardless of whether they come from stdlib. Classes that
descend straight from BasicObject do not see top-level constants:

    X = 1

    class C < BasicObject
      X # raises NameError
    end

The reason for that error is that Object does not belong to the nesting,
and it is not an ancestor of C, so the constant name resolution algorithm
fails to find X. You need a fully-qualified ::X.

These kind of classes do not even see constants for core stuff:

    class D < BasicObject
      String # raises NameError
    end

String is no different than X in this regard, they are just top-level
constants. String happens to be defined when your program boots, but other
than that it has no special significance at all. It is an ordinary constant
that stores a class object and Ruby finds it using the constant resolution
algorithms at runtime, as any other constant.

I guess Delegator.const_missing wants somehow to hide from the user that it
doesn't descend from Object.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to