In Ruby .respond_to? Validation method for Ruby, not Rails, which has reply_to
It takes a character and returns true if the object can get this method, else it returns false
Your first code does not have a dot ( . ) Before the_to answer? ... when I ran it, printed hi , but did not receive a confirmation of the true state.
Syntax: object.respond_to? (: method)
-> [1,2,3,5,8,13]. Does it fit? (: push)
source share