Module: Rein::Constraint::Match

Includes:
ActiveRecord::ConnectionAdapters::Quoting
Included in:
ActiveRecord::Migration
Defined in:
lib/rein/constraint/match.rb

Overview

This module contains methods for defining regex match constraints.

Constant Summary collapse

OPERATORS =
{
  accepts: :~,
  rejects: :"!~"
}.freeze

Instance Method Summary collapse

Instance Method Details

#add_match_constraint(*args) ⇒ Object



14
15
16
17
18
19
# File 'lib/rein/constraint/match.rb', line 14

def add_match_constraint(*args)
  reversible do |dir|
    dir.up { _add_match_constraint(*args) }
    dir.down { _remove_match_constraint(*args) }
  end
end

#remove_match_constraint(*args) ⇒ Object



21
22
23
24
25
26
# File 'lib/rein/constraint/match.rb', line 21

def remove_match_constraint(*args)
  reversible do |dir|
    dir.up { _remove_match_constraint(*args) }
    dir.down { _add_match_constraint(*args) }
  end
end