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_register_context) ⇒ Object
-
#initialize(reference, position, index) ⇒ RegisterElement
constructor
supports ‘get` and `set`.
- #inspect ⇒ Object
- #key ⇒ Object
- #literal? ⇒ Boolean
- #set(value, event_register_context) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(reference, position, index) ⇒ RegisterElement
supports ‘get` and `set`
31 32 33 34 35 36 |
# File 'lib/logstash/filters/math_calculation_elements.rb', line 31 def initialize(reference, position, index) @reference = reference @position = position @index = index @description = (position == 3 ? "#{@index}" : "operand #{@position}").prepend("register ").concat(": '#{@reference}'") end |
Instance Method Details
#get(event_register_context) ⇒ Object
51 52 53 |
# File 'lib/logstash/filters/math_calculation_elements.rb', line 51 def get(event_register_context) event_register_context.get(self) #log warning if nil end |
#inspect ⇒ Object
55 56 57 |
# File 'lib/logstash/filters/math_calculation_elements.rb', line 55 def inspect "\"#{@description}\"" end |
#key ⇒ Object
38 39 40 |
# File 'lib/logstash/filters/math_calculation_elements.rb', line 38 def key @index end |
#literal? ⇒ Boolean
42 43 44 |
# File 'lib/logstash/filters/math_calculation_elements.rb', line 42 def literal? false end |
#set(value, event_register_context) ⇒ Object
46 47 48 49 |
# File 'lib/logstash/filters/math_calculation_elements.rb', line 46 def set(value, event_register_context) # raise usage error if called when position != 3 ?? event_register_context.set(self, value) end |
#to_s ⇒ Object
59 60 61 |
# File 'lib/logstash/filters/math_calculation_elements.rb', line 59 def to_s @description end |