Module: DataMapper::Assertions

Included in:
DataMapper, Adapters, DataMapper::Adapters::AbstractAdapter, DataMapper::Adapters::AbstractAdapter, DataMapper::Associations::Relationship, Hook::ClassMethods, Model::Relationship, Property, Query, Query::Conditions::AbstractOperation, Query::Operator, Query::Path, Repository, Resource
Defined in:
lib/dm-core/support/assertions.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) assert_kind_of(name, value, *klasses)

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