Class: RulesProcessor::RuleMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/rules_processor/rule_matcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ RuleMatcher

Returns a new instance of RuleMatcher.



6
7
8
9
10
# File 'lib/rules_processor/rule_matcher.rb', line 6

def initialize(args = {})
  @records = args[:records]
  @rule    = args[:rule]
  @options = args[:options]
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



4
5
6
# File 'lib/rules_processor/rule_matcher.rb', line 4

def options
  @options
end

#recordsObject

Returns the value of attribute records.



4
5
6
# File 'lib/rules_processor/rule_matcher.rb', line 4

def records
  @records
end

#ruleObject

Returns the value of attribute rule.



4
5
6
# File 'lib/rules_processor/rule_matcher.rb', line 4

def rule
  @rule
end

Instance Method Details

#matches?Boolean

Returns:

  • (Boolean)


12
13
14
15
# File 'lib/rules_processor/rule_matcher.rb', line 12

def matches?
  return false if both_condition_group_empty?
  meet_all_matches? || meet_any_matches?
end