Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/martin/dsl.rb
Instance Method Summary collapse
-
#should_be_a(cls) ⇒ Object
Throw a TypeError unless this object’s type is cls.
Instance Method Details
#should_be_a(cls) ⇒ Object
Throw a TypeError unless this object’s type is cls
5 6 7 |
# File 'lib/martin/dsl.rb', line 5 def should_be_a(cls) raise(TypeError, "#{self.to_s} must be of type #{cls.to_s}") unless self.is_a?(cls) end |