Module: XlsFunction::TransformRules::BinaryOperationTransform

Included in:
XlsFunction::Transform
Defined in:
lib/xls_function/transform_rules/binary_operation_transform.rb

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/xls_function/transform_rules/binary_operation_transform.rb', line 4

def self.included(klass)
  klass.class_eval do
    rule(left: subtree(:left), operator: simple(:operator), right: subtree(:right)) do |context|
      ope = ::XlsFunction::Evaluators::BinaryOperationEvaluator.from_dictionary(context[:operator].to_s)
      raise ::XlsFunction::Transform::NotImplementedFunctionError, "not supported operator #{context[:operator]}" unless ope

      ope.create(context[:left], context[:right], context)
    end
  end
end