Module: DbAgile::Core::Schema::Robustness

Included in:
DbAgile::Core::Schema
Defined in:
lib/dbagile/core/schema/robustness.rb

Instance Method Summary collapse

Instance Method Details

#builder!(arg, arg_name = :builder, cal = caller) ⇒ Object

Asserts that arg is a Schema::Builder or raises an ArgumentError



19
20
21
22
23
24
# File 'lib/dbagile/core/schema/robustness.rb', line 19

def builder!(arg, arg_name = :builder, cal = caller)
  unless arg.kind_of?(Schema::Builder)
    raise ArgumentError, "Builder expected for #{arg_name}, got #{arg.class}", cal
  end
  arg
end

#hash!(arg, arg_name = :options, cal = caller) ⇒ Object

Asserts that arg is a Hash or raises an ArgumentError



29
30
31
32
33
34
# File 'lib/dbagile/core/schema/robustness.rb', line 29

def hash!(arg, arg_name = :options, cal = caller)
  unless arg.kind_of?(Hash)
    raise ArgumentError, "Hash expected for #{arg_name}, got #{arg.class}", cal
  end
  arg
end

#schema!(arg, arg_name = :schema, cal = caller) ⇒ Object

Asserts that arg is a Schema::DatabaseSchema or raises an ArgumentError



9
10
11
12
13
14
# File 'lib/dbagile/core/schema/robustness.rb', line 9

def schema!(arg, arg_name = :schema, cal = caller)
  unless arg.kind_of?(Schema::DatabaseSchema)
    raise ArgumentError, "Schema expected for #{arg_name}, got #{arg.class}", cal
  end
  arg
end