Class: Pal::Operation::FilterEvaluator

Inherits:
Object
  • Object
show all
Defined in:
lib/pal/operation/filter_evaluator.rb

Overview

Filter evaluator runs the filter processes to identify candidates

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filters) ⇒ FilterEvaluator

Returns a new instance of FilterEvaluator.



14
15
16
# File 'lib/pal/operation/filter_evaluator.rb', line 14

def initialize(filters)
  @rule = RuleFactory.from_hash(filters)
end

Instance Attribute Details

#ruleRule (readonly)

Returns:



12
13
14
# File 'lib/pal/operation/filter_evaluator.rb', line 12

def rule
  @rule
end

Instance Method Details

#test_property(row, column_headers) ⇒ Boolean

Parameters:

  • row (Array)
  • column_headers (Hash)

Returns:

  • (Boolean)


21
22
23
24
25
26
# File 'lib/pal/operation/filter_evaluator.rb', line 21

def test_property(row, column_headers)
  return true if @rule.nil?

  eval_ctx = EvaluationContext.new(row, column_headers)
  @rule.evaluate(eval_ctx)
end