Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Module.nesting for anonymous modules?

Reply
Thread Tools

Module.nesting for anonymous modules?

 
 
James Coglan
Guest
Posts: n/a
 
      11-15-2008
[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
AST.

foo = Module.new do
def m
Module.nesting
end
end
=> #<Module:0x28879c4>

c = Class.new { include foo }
=> #<Class:0x287164c>

c.new.m
=> []

Is there any way for a method defined like this to get a reference to its
containing module?

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is this a local anonymous class or a member anonymous class Reporter Java 3 05-12-2007 05:23 AM
help with an anonymous array of anonymous hashes noeldamonmiller@gmail.com Perl Misc 1 02-10-2005 01:08 AM
Problem when using and creating nested (anonymous) arrays. moller@notvalid.se Perl 1 02-18-2004 12:35 AM
How do I call sort with an anonymous subroutine stored in a hash ?? Casey Perl 3 01-30-2004 03:39 PM
Pix is anonymous proxy from outside Sean James Cisco 2 12-08-2003 04:22 PM



Advertisments