Module: DataMapper::Assertions

Instance Method Summary collapse

Instance Method Details

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

Raises:

  • (ArgumentError)


3
4
5
6
# File 'lib/dm-core/support/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