Mega Code Archive

 
Categories / Ruby / Reflection
 

Look at an objects ancestors with Modules ancestors method, which returns a list of both classes and modules

myString = "asdf" p myString.class.ancestors # => [String, Enumerable, Comparable, Object, Kernel] p String.ancestors # => [String, Enumerable, Comparable, Object, Kernel]