A singleton class in the simplest terms is a special class ruby whips up to host methods defined on individual objects. In ruby, it is possible to define methods on individual objects that are unique to that object alone. For instance consider the following below
class User; end
user = User.new
def user.age
"i'm a unique method"
end
user1 = User.new
user.age #"i'm a unique method"
user1.age # NoMethodError (undefined method `age' for #<User:0x0000559c66ab7338>)
As you can see above, user1 object does not respond to the 'age' method because it is a singleton method, a method uniquely defined on user object. For this to happen, ruby creates a special class, called singleton class, or eigenclass, to host this unique method. You can verify this by doing the following:
user.singleton_class # #<Class:#<User:0x0000559c66b47c58>>
You can also ask ruby whether the 'age' method is found here by using the method object to find out where the method 'age' is defined. When you do this you will see that singleton class has that method.
user_singleton_class = user.method(:age).owner # #<Class:#<User:0x0000559c66b47c58>>
user.method(:age).owner == user.singleton_class # true
user_singleton_class.instance_methods(false) # [:age]
Also note that, as far a singleton class goes, singleton methods are actually it's instance methods.
user.singleton_methods == user_singleton_class.instance_methods(false) # true