Yehuda Katz
(ph) 718.877.1325


On Tue, Nov 29, 2011 at 10:04 PM, Yukihiro Matsumoto <matz / ruby-lang.org>wr=
ote:

> Hi,
>
> In message "Re: [ruby-core:41404] [ruby-trunk - Bug #5690][Open]
> Module#qualified_const_get"
>     on Wed, 30 Nov 2011 12:10:02 +0900, Yehuda Katz <wycats / gmail.com>
> writes:
>
> |It would be great if there was a way to dynamically load a constant path=
:
> |
> |  module Foo
> |    module Bar
> |      module Baz
> |      end
> |    end
> |  end
> |
> |  Foo.qualified_const_get("Bar::Baz") =3D> Foo::Bar::Baz
>
> Interesting.
>
> * is there any use-case for this method?
>

We use it often in Rails.


> * if Bar is not a class nor module, what kind error should be raised?
>

TypeError: "(=85) is not a class/module"


> * is qualified_const_get an appropriate name for the function?
>

Unknown. It's what we call it in Rails ;)


>
>                                                        matz.
>
>