use the included_modules method to discover what modules a class uses : Module Reflection « Reflection « Ruby






use the included_modules method to discover what modules a class uses


puts Object.included_modules # => [Kernel]
puts Numeric.included_modules # => [Comparable, Kernel]
puts Integer.included_modules # => [Precision, Comparable, Kernel]
puts Fixnum.included_modules # => [Precision, Comparable, Kernel]

 








Related examples in the same category

1.Discover the names of any of the included modules of an instance or its class using the included_modules method from Module.