Module.nesting for anonymous modules?

Discussion in 'Ruby' started by James Coglan, Nov 15, 2008.

  1. James Coglan

    James Coglan Guest

    [Note: parts of this message were removed to make it a legal post.]

    Hi list,

    I'm trying to get a reference to the module that a method is defined in,
    problem being that the module is generated dynamically so is not part of the

    foo = do
    def m
    => #<Module:0x28879c4>

    c = { include foo }
    => #<Class:0x287164c>
    => []

    Is there any way for a method defined like this to get a reference to its
    containing module?
    James Coglan, Nov 15, 2008
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.