responds_to?

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

a = 1
a.responds_to?(:abs)  # => true
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?(...).

To the extent possible under law, the persons who contributed to this workhave waived
all copyright and related or neighboring rights to this workby associating CC0 with it.
https://crystal-lang.org/reference/syntax_and_semantics/responds_to.html