Excerpts from Arup R.'s message of 2014-01-29 15:52:43 +0100:
irb(main):007:0> Animal.respond_to?(:bark)
if I understand this Animal.respond_to?(:bark) # => false, I can’t
understand Object.respond_to?(:foo) # => true .
Because everything in ruby is an instance of Object, including instances
of class Class
(that is, including classes). Since your foo method is an instance
method of
Object, it can be called on everything. You can check this by calling:
Animal.foo. It
won’t raise exceptions.
I hope this helps
Stefano
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.