Module: LogStash::Filters::MathCalculationElements
- Defined in:
- lib/logstash/filters/math_calculation_elements.rb
Defined Under Namespace
Classes: FieldElement, LiteralElement, RegisterElement
Constant Summary collapse
- REGISTER_REFERENCE_RE =
/^MEM\[(\d+)]$/
Class Method Summary collapse
Class Method Details
.build(reference, position, register) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/logstash/filters/math_calculation_elements.rb', line 8 def self.build(reference, position, register) 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, register) else FieldElement.new(reference, position) end else nil end end |