Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardRubysingleton eigenclassSingle-choice MCQ

Two consecutive calls to the same object's singleton_class return the same object, yet calling singleton_class on an Integer raises TypeError. What internal facts explain both observations?

o = Object.new puts o.singleton_class.equal?(o.singleton_class) begin 1.singleton_class rescue TypeError => e puts "TypeError" end