[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Problem with Module/Class name resolution

Thomas Leitner

2/19/2007 4:01:00 PM

Hi,

consider the following:

module A
X = 1
end

p A::X # => 1

module B
include A
end

p B::X # => 1

module A
module Help
p X # => 1
end
end

module B
module Help
p X # => NameError: uninitialized constant B::Help::X
end
end


Why does referencing X from A, B, and A::Help work but not from
B::Help although A is included in B? Is there a work-around to make
this work?

Bye,
Thomas