From: Bernardo Monteiro Rufino Date: 2009-01-01T16:21:03+09:00 Subject: Re: Constant visibility ------=_Part_120399_26473306.1230794505187 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline You might be looking for extend instead of include: > module Foo > > def foo > puts self::FooBar::TEST; > end > > end > > module Bar > > extend Foo; > > class FooBar > TEST = "Whatever"; > end > > end > > Bar.foo; # Prints out "Whatever" > See if it works for you On Tue, Dec 30, 2008 at 10:30 PM, Sean O'Halpin wrote: > On Tue, Dec 30, 2008 at 11:20 PM, Nicholas Wieland > wrote: > > Hi *, > > [snip example code] > > > Can you suggest me a way to accomplish that, to have a method inside a > > module that checks data inside a class in another module, and define the > > rules in the class itself ? > > This is one approach: > > module Included > def whatever > puts self.class::FOO > end > end > > module Includer > class Whatever > include Included > FOO = 'whatever' > end > end > > o = Includer::Whatever.new > o.whatever # => "whatever" > > Note you have to include the module inside the class - including it in > the enclosing module does not do what you may think :) > > Regards, > Sean > > -- Bernardo Rufino ------=_Part_120399_26473306.1230794505187--