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

With the definitions below, evaluating `B::Z` (an undefined constant) triggers `B.const_missing`, but `B::Y` does not. What is the precise rule that decides whether `const_missing` fires?

class A Y = 2 end class B < A def self.const_missing(name) "missing: #{name}" end end B::Y # => 2 B::Z # => "missing: Z"