I've seen this in code before and I just read about it in The Well Grounded Rubyist by David A. Black, but there are no examples of use cases to help me understand why someone would want to define a singleton method on a class like this:
class Vehicle
class << self
def all_makes
# some code here
end
end
end
How is the above singleton method on a class different than the usual class method like this:
class Vehicle
def self.all_makes
# some code here
end
end