responds_to?

The pseudo-method responds_to? determines whether a type has a method with the given name. For example:

  1. a = 1
  2. a.responds_to?(:abs) # => true
  3. a.responds_to?(:size) # => false

It is a pseudo-method because it only accepts a symbol literal as its argument, and is also treated specially by the compiler, as explained in if var.responds_to?(…).