Redefinition of const_missing method in the Singleton class of Module class doesn't seem to work. But it works if I redefine directly in the class Module. Any reason why?
class Module
class << self
def const_missing(constant)
puts "This doesn't work!"
end
end
end
Hello
Where as the following works!
class Module
def const_missing(constant)
puts 'This works!'
end
end
Hello
Context:
- Trying to use
superin cases where the constants fall into a category thats not to be overridden. Say constants that do not match a pattern should still cause aNameError.