Class: LogStash::Filters::MathCalculationElements::RegisterElement
- Inherits:
-
Object
- Object
- LogStash::Filters::MathCalculationElements::RegisterElement
- Defined in:
- lib/logstash/filters/math_calculation_elements.rb
Instance Method Summary collapse
- #get(event) ⇒ Object
-
#initialize(reference, position, index, register) ⇒ RegisterElement
constructor
supports ‘get` and `set`.
- #inspect ⇒ Object
- #literal? ⇒ Boolean
- #set(value, event) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(reference, position, index, register) ⇒ RegisterElement
supports ‘get` and `set`
31 32 33 34 35 36 37 |
# File 'lib/logstash/filters/math_calculation_elements.rb', line 31 def initialize(reference, position, index, register) @reference = reference @position = position @index = index @register = register @description = (position == 3 ? "#{@index}" : "operand #{@position}").prepend("register ").concat(": '#{@reference}'") end |
Instance Method Details
#get(event) ⇒ Object
48 49 50 |
# File 'lib/logstash/filters/math_calculation_elements.rb', line 48 def get(event) @register[@index] #log warning if nil end |
#inspect ⇒ Object
52 53 54 |
# File 'lib/logstash/filters/math_calculation_elements.rb', line 52 def inspect "\"#{@description}\"" end |
#literal? ⇒ Boolean
39 40 41 |
# File 'lib/logstash/filters/math_calculation_elements.rb', line 39 def literal? false end |
#set(value, event) ⇒ Object
43 44 45 46 |
# File 'lib/logstash/filters/math_calculation_elements.rb', line 43 def set(value, event) # raise usage error if called when position != 3 ?? @register[@index] = value end |
#to_s ⇒ Object
56 57 58 |
# File 'lib/logstash/filters/math_calculation_elements.rb', line 56 def to_s @description end |