Class: RecordStore::Zone::Config::IgnorePattern

Inherits:
Object
  • Object
show all
Defined in:
lib/record_store/zone/config/ignore_pattern.rb

Constant Summary collapse

MATCH_TYPE_FIELD =
'match'
MATCH_TYPE_REGEX =
'regex'
MATCH_TYPE_EXACT =
'exact'

Instance Method Summary collapse

Constructor Details

#initialize(orig_hash) ⇒ IgnorePattern

Returns a new instance of IgnorePattern.



11
12
13
# File 'lib/record_store/zone/config/ignore_pattern.rb', line 11

def initialize(orig_hash)
  @orig_hash = orig_hash
end

Instance Method Details

#ignore?(record) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
18
19
# File 'lib/record_store/zone/config/ignore_pattern.rb', line 15

def ignore?(record)
  all_pairs.all? do |(key, value)|
    record.respond_to?(key) && value_matches?(value, record.send(key))
  end
end

#to_hashObject



21
22
23
# File 'lib/record_store/zone/config/ignore_pattern.rb', line 21

def to_hash
  @orig_hash
end