Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardRubyconst_missing included inherited hooksSingle-choice MCQ

A class defines `def self.const_missing(name); ...; end` AND a separate instance-level `const_missing` is not defined. When you reference an undefined constant `Foo::BAR`, why is the singleton-method (`def self.const_missing`) form the one that actually fires?

class Foo def self.const_missing(name) "missing #{name}" end end Foo::BAR