Module: Rein::Constraint::Length
- Included in:
- ActiveRecord::Migration
- Defined in:
- lib/rein/constraint/length.rb
Overview
This module contains methods for defining length constraints.
Constant Summary collapse
- OPERATORS =
{ greater_than: :>, greater_than_or_equal_to: :>=, equal_to: :"=", not_equal_to: :"!=", less_than: :<, less_than_or_equal_to: :<= }.freeze
Instance Method Summary collapse
Instance Method Details
#add_length_constraint(*args) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/rein/constraint/length.rb', line 16 def add_length_constraint(*args) reversible do |dir| dir.up { _add_length_constraint(*args) } dir.down { _remove_length_constraint(*args) } end end |
#remove_length_constraint(*args) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/rein/constraint/length.rb', line 23 def remove_length_constraint(*args) reversible do |dir| dir.up { _remove_length_constraint(*args) } dir.down { _add_length_constraint(*args) } end end |