module HTML::Mixin::StrongTyping

The StrongTyping module is a pure Ruby replacement for the strongtyping gem.

Public Instance Methods

expect(arg, allowed_types) click to toggle source
# 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