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.



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

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.



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

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

#process(&block) ⇒ Object

Alias of instance_eval for a nicer API.



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

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