From: Tom Agnew Date: 2006-11-09T14:40:06+09:00 Subject: Re: accessing class constants in included modules Martin DeMello wrote: > module Foo > def display > puts self.class::A > end > end > > class Bar > A = 5 > include Foo > end > > class Baz > A = 6 > include Foo > end > > Bar.new.display > Baz.new.display > > > Anything cleaner-looking than self.class::Constant to access the > constant from a method defined in the module? > > martin > Here's a trick I use to beautify access to constants: class Object def my self.class end end ....Now all constants can be accessed with my::Constant. I find it more readable. Certainly less typing! Cheers, Tom Agnew