Class: LightRulesEngine::OperatorContxt

Inherits:
Object
  • Object
show all
Defined in:
lib/light_rules_engine/operator_contxt.rb

Instance Method Summary collapse

Constructor Details

#initialize(operator_hash, data_provider) ⇒ OperatorContxt

Returns a new instance of OperatorContxt.



3
4
5
6
# File 'lib/light_rules_engine/operator_contxt.rb', line 3

def initialize(operator_hash, data_provider)
  @operator_hash = operator_hash
  @data_provider = data_provider
end

Instance Method Details

#operatorObject



8
9
10
# File 'lib/light_rules_engine/operator_contxt.rb', line 8

def operator
  @operator ||= config[:operators_namespace].find(operator_hash[:type])
end

#resultObject



16
17
18
# File 'lib/light_rules_engine/operator_contxt.rb', line 16

def result
  operator.result(*values)
end

#valuesObject



12
13
14
# File 'lib/light_rules_engine/operator_contxt.rb', line 12

def values
  operator_hash[:values].map(&method(:resolve))
end