This method is to return eigenclass of any object:
class Object
def eigenclass
class << self; self; end
end
end
Example for String:
"abc".eigenclass # => #<Class:#<String:0x331df0>>
Array:
[1, 2].eigenclass # => #<Class:#<Array:0x0000000065d218>>
But with Fixnum:
1.eigenclass # => TypeError: can't define singleton
Why?