From: "Wayne E. Seguin" Date: 2007-07-08T12:18:00+09:00 Subject: Re: get modules that are in a class? --Apple-Mail-4--600951793 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On Jul 07, 2007, at 23:06 , Wayne E. Seguin wrote: > Aaron, > > you can define a method within your class to expose this like so: > > module TestModule > def say_something > puts "SOMETHING" > end > end > > class Test > include TestModule > def modules > self.class.included_modules > end > end > > t = Test.new > puts t.modules > > > If you need this exposed for all classes you can expose for the > Object class: > > class Object > def modules > self.class.included_modules > end > end > > Does this help? > Without knowing what you're trying to accomplish further it's > difficult to come up with an optimal solution :) Aaron, Scratch that last, it's far easier than that: module TestModule def say_something puts "SOMETHING" end end class Test include TestModule end t = Test.new puts t.class.included_modules -- Wayne E. Seguin Sr. Systems Architect & Systems Admin wayneseguin@gmail.com --Apple-Mail-4--600951793--