Class: RulesProcessor::ConditionMatcher

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ ConditionMatcher

Returns a new instance of ConditionMatcher.



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

def initialize(args = {})
  @records   = args[:records]
  @condition = OpenStruct.new(args[:condition])
end

Instance Attribute Details

#conditionObject

Returns the value of attribute condition.



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

def condition
  @condition
end

#recordsObject

Returns the value of attribute records.



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

def records
  @records
end

Instance Method Details

#matches?Boolean

Returns:

  • (Boolean)


11
12
13
14
# File 'lib/rules_processor/condition_matcher.rb', line 11

def matches?
  klass = Object.const_get(klass_name)
  klass.new(records: records, condition: condition).perform
end