Module: Extlib::Assertions

Included in:
Hook::ClassMethods
Defined in:
lib/extlib/assertions.rb

Instance Method Summary collapse

Instance Method Details

#assert_kind_of(name, value, *klasses) ⇒ Object

Raises:

  • (ArgumentError)


3
4
5
6
# File 'lib/extlib/assertions.rb', line 3

def assert_kind_of(name, value, *klasses)
  klasses.each { |k| return if value.kind_of?(k) }
  raise ArgumentError, "+#{name}+ should be #{klasses.map { |k| k.name } * ' or '}, but was #{value.class.name}", caller(2)
end