module LogStash::Filters::MathCalculationElements

Constants

REGISTER_REFERENCE_RE

Public Class Methods

build(reference, position) click to toggle source
# File lib/logstash/filters/math_calculation_elements.rb, line 8
def self.build(reference, position)
  case reference
  when Numeric
    if position == 3
      # literal reference for result element
      nil
    else
      LiteralElement.new(reference, position)
    end
  when String
    match = REGISTER_REFERENCE_RE.match(reference)
    if match
      RegisterElement.new(reference, position, match[1].to_i)
    else
      FieldElement.new(reference, position)
    end
  else
    nil
  end
end