responds_to?

responds_to?

의사 메서드(pseudo-method) responds_to?는 타입이 주어진 이름의 메서드를 갖고 있는지 판단해요. 예를 들어:

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

responds_to?는 의사 메서드예요. 인자로 심볼 리터럴만 받고, if var.responds_to?(...)에서 설명하듯 컴파일러가 특별히 취급하기 때문입니다.

출처: Crystal 공식 문서 - responds_to?

더 알아보기 (Learn more)