From: Andrew Wagner Date: 2011-02-03T08:15:04+09:00 Subject: Re: Amazing behavior of include module --001636c5b3226bb328049b54d139 Content-Type: text/plain; charset=UTF-8 This is really quite odd to me. Especially since AAA::BBB.constants returns an empty array. Anybody have an answer to this? On Wed, Feb 2, 2011 at 11:49 AM, Pavel Strnad wrote: > Hi, > I do not understand how is following code working: > irb(main):001:0> module AAA > irb(main):002:1> class BBB > irb(main):003:2> end > irb(main):004:1> end > => nil > irb(main):005:0> BBB::BBB > NameError: uninitialized constant BBB > from (irb):5 > from /usr/local/bin/irb:12:in `
' > irb(main):006:0> AAA::BBB::BBB > NameError: uninitialized constant AAA::BBB::BBB > from (irb):6 > from /usr/local/bin/irb:12:in `
' > irb(main):007:0> include AAA > => Object > irb(main):008:0> BBB::BBB > => AAA::BBB > irb(main):009:0> BBB::BBB::BBB > => AAA::BBB > irb(main):010:0> BBB::BBB::BBB::BBB > => AAA::BBB > irb(main):011:0> AAA::BBB::BBB::BBB > => AAA::BBB > > I thought that last four lines will not work, but they do. How is it > possible? > Thank you. > Pavel Strnad > > --001636c5b3226bb328049b54d139--