Method: Object#aT_kind_of
- Defined in:
- lib/y_support/typing/object/typing.rb
#aT_kind_of(klass, what_is_receiver = nil) ⇒ Object Also known as: aT_is_a
Fails with TypeError unless the receiver is of the prescribed class. Second optional argument customizes the error message (receiver description).
81 82 83 84 85 86 87 |
# File 'lib/y_support/typing/object/typing.rb', line 81 def aT_kind_of klass, what_is_receiver=nil m = "%s is not a kind of #{klass}!" % if what_is_receiver then what_is_receiver.to_s.capitalize else "#{self.class} instance #{object_id}" end tap { kind_of? klass or fail TypeError, m } end |