Advertisements

On Jan 19, 2008, at 12:29 AM, Daniel Brumbaugh Keeney wrote:
> Is there an obvious method for a module like
> A::B::C
> that would result in A::B?

What do you mean?

You know, modules are objects, constants are stored in modules. Given
those rules you can put a module almost anywhere. AFAICT what you
cannot change via API is its name, which is set in stone the first
time a module is assigned to a constant. That happens in regular
module definitions, or explicitly like this:

Advertisements

On Jan 19, 2008, at 1:07 AM, Xavier Noria wrote:
> On Jan 19, 2008, at 12:29 AM, Daniel Brumbaugh Keeney wrote:
>
>> Is there an obvious method for a module like
>> A::B::C
>> that would result in A::B?
>
> What do you mean?

Oh, perhaps you just want something like Module#parent provided by
Active Support. There the parent is computed by hand from the module
name:

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!