Hi --
On Fri, 5 Dec 2008, Oliver Saunders wrote:
> If I say:
>
> module Foo
> def zim; end
> end
> class Bar
> class << self
> include Foo
> end
> end
>
> # Bar.zim is now available
>
> How can I find out which modules are included into Bar at class-level.
>
> Some attempts:
>
> Bar.included_modules
> Bar.class.included_modules
> Bar.class.new.included_modules
> Bar.ancestors
> Bar.class.ancestors
> Bar.class.new.ancestors
>
> None of them return anything with Foo in it.
Query the class into which you included the module:
class << Bar
ancestors
end
David
--
Rails training from David A. Black and Ruby Power and Light:
INTRO TO RAILS (Jan 12-15), Fort Lauderdale, FL
See
http://www.rubypal.com for details
Coming in 2009: The Well-Grounded Rubyist (
http://manning.com/black2)