Hi,
I've changed `const_get` in Ruby 2.0. If it were implemented in 1.9, it
would look roughly like this:
def const_get name, inherited = true
name.to_s.split('::').inject(self.class) do |klass, name|
klass.const_get name, inherited
end
end
I was hoping we could use this to replace the implementation of
`constantize`, but it seems we have an inconsistency in the way that
`constantize` works in regard to constant inheritance.
I've written a test to demonstrate the problem:
https://gist.github.com/4024158
For some reason `constantize` inherits constants, but not when the
constant is defined on Object, where `const_get` in Ruby 2.0 will always
honor the inheritance (even if the constant is defined at the top).
Is there any chance we can change this?
--
Aaron Patterson
http://tenderlovemaking.com/
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Core" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en.