To determine the name of the superclass : Class Reflection « Reflection « Ruby






To determine the name of the superclass


myString = "asdf"
myString.class.superclass # => Object
String.superclass # => Object

 








Related examples in the same category

1.Call ancestors on a class name to see its inheritance hierarchy, like this:
2.The Object class has a class method that returns the name of an instance's class
3.class attribute of string instance
4.The class method supercedes Object's deprecated method type, or gets the name of the class as a string with the name method
5.Reflection and Metaprogramming Introduction