Class: ActiveSchema::Validations::Generator
- Inherits:
-
Object
- Object
- ActiveSchema::Validations::Generator
- Defined in:
- lib/active_schema/validations/generator.rb
Instance Method Summary collapse
- #generate ⇒ Object
- #generate_for_columns ⇒ Object
- #generate_for_indexes ⇒ Object
-
#initialize(table, skip_validation_for_column) ⇒ Generator
constructor
A new instance of Generator.
Constructor Details
#initialize(table, skip_validation_for_column) ⇒ Generator
Returns a new instance of Generator.
19 20 21 22 23 |
# File 'lib/active_schema/validations/generator.rb', line 19 def initialize(table, skip_validation_for_column) @table = table @model = table.model @skip_validation_for_column = skip_validation_for_column end |
Instance Method Details
#generate ⇒ Object
25 26 27 28 |
# File 'lib/active_schema/validations/generator.rb', line 25 def generate generate_for_columns generate_for_indexes end |
#generate_for_columns ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/active_schema/validations/generator.rb', line 30 def generate_for_columns @model.columns.each do |column| next if @skip_validation_for_column.call(column) ByDataType.new(@model, column).generate ByNullability.new(@model, column).generate end end |
#generate_for_indexes ⇒ Object
38 39 40 |
# File 'lib/active_schema/validations/generator.rb', line 38 def generate_for_indexes end |