Module: HTML::Mixin::StrongTyping
- Included in:
- Table, Table, Table::Caption, Table::ColGroup, Table::ColGroup, Table::TableSection, Table::TableSection, Table::Body, Table::ColGroup::Col, Table::Foot, Table::Head, Table::Row, Table::Row, Table::Row::Data, Table::Row::Header
- Defined in:
- lib/html/mixin/strongtyping.rb
Overview
The StrongTyping module is a pure Ruby replacement for the strongtyping gem.
Instance Method Summary collapse
Instance Method Details
#expect(arg, allowed_types) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/html/mixin/strongtyping.rb', line 7 def expect(arg, allowed_types) return true if Array(allowed_types).any? do |klass| arg.is_a?(klass) end # Defined in table.rb raise ArgumentTypeError, "#{arg} must be of type #{allowed_types}" end |