Why respond_to with initialize() returns false?
Why do I get false when I do C.respond_to?(:initialize)
class C
def initialize;end
def meth;end
end
C.respond_to?(:initialize) #=> false
C.new.respond_to?(:meth) #=> true as expected
Another variation
class C
def initialize;end
def meth
pmeth
end
private
def pmeth
respond_to?(:initialize)
end
end
No comments:
Post a Comment