Class: Sequel::ConstraintValidations::Generator

Inherits:
Object
  • Object
show all
Defined in:
lib/sequel/extensions/constraint_validations.rb

Overview

This is the DSL class used for the validate block inside create_table and alter_table.

Instance Method Summary collapse

Constructor Details

#initialize(generator) ⇒ Generator

Store the schema generator that encloses this validates block.



140
141
142
# File 'lib/sequel/extensions/constraint_validations.rb', line 140

def initialize(generator)
  @generator = generator
end

Instance Method Details

#drop(constraint) ⇒ Object

Given the name of a constraint, drop that constraint from the database, and remove the related validation metadata.



164
165
166
# File 'lib/sequel/extensions/constraint_validations.rb', line 164

def drop(constraint)
  @generator.validation({:type=>:drop, :name=>constraint})
end

#process(&block) ⇒ Object

Alias of instance_eval for a nicer API.



169
170
171
# File 'lib/sequel/extensions/constraint_validations.rb', line 169

def process(&block)
  instance_eval(&block)
end