If I define a class-method in Ruby Object class, how do I get the name of a child class calling this method?
Example
开发者_运维问答def Object.const_missing(name)
puts self.class
end
class A; end
A::B # => Class
How can I get A
in Object#const_missing
?
def Object.const_missing(name)
puts self
end
精彩评论