# Module.nesting strangeness

**URL:** <https://www.ruby-forum.com/t/module-nesting-strangeness/179514>\
**Category:** Ruby\
**Created:** [November 26, 2009, 3:53pm UTC](https://www.ruby-forum.com/t/module-nesting-strangeness/179514 "2009-11-26T15:53:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexandremutel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a88e4f/32.png) [@alexandremutel](https://www.ruby-forum.com/u/alexandremutel)\
**Post date:** [November 26, 2009, 3:53pm UTC](https://www.ruby-forum.com/t/module-nesting-strangeness/179514/1 "2009-11-26T15:53:40Z")

</div>

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:🅱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?
