Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Module.nesting strangeness

Reply
Thread Tools

Module.nesting strangeness

 
 
Alexandre Mutel
Guest
Posts: n/a
 
      11-26-2009
Hi,
i'm encountering a weird behavior of the Module.nesting methodd. Here is
my testcase from the irb:

____________________________

class A
class B
def test()
puts "Module.nesting : " + Module.nesting * ","
end
end
end
=> nil

b = A::B.new
=> #<A::B:0x24102d8>

b.test
Module.nesting : A::B,A
=> nil

b.instance_eval { puts "Module.nesting : " + Module.nesting * "," }
Module.nesting :
=> nil
____________________________

The documentation says : "Returns the list of Modules nested at the
point of call. ". But how Module.nesting in test() method knows that it
was declared inside the class A/classB and not outside?
--
Posted via http://www.ruby-forum.com/.

 
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
VLAN strangeness PabloFiasko Cisco 0 06-01-2005 09:05 AM
Bookmarks Strangeness Drude Firefox 0 01-26-2005 01:28 AM
OT: Friday strangeness Ken Briscoe MCSE 6 05-30-2004 08:19 AM
Strangeness in bookmarks are still occurring Keith Bowes Firefox 0 01-06-2004 11:18 PM
autoincrement strangeness - please help! Munnki Perl 2 12-18-2003 10:51 PM



Advertisments