obj.singleton_class â class
Instance Public methods
Returns the singleton class of obj. This method creates a new singleton class if obj does not have it.
If obj is nil
, true
, or
false
, it returns NilClass, TrueClass, or FalseClass, respectively. If obj is a
Fixnum or a Symbol, it
raises a TypeError.
Object.new.singleton_class #=> #<Class:#<Object:0xb7ce1e24>> String.singleton_class #=> #<Class:String> nil.singleton_class #=> NilClass
Please login to continue.