Class: LogStash::KeyNode
- Inherits:
-
Object
- Object
- LogStash::KeyNode
- Defined in:
- lib/logstash/string_interpolation.rb
Instance Method Summary collapse
- #evaluate(event) ⇒ Object
-
#initialize(key) ⇒ KeyNode
constructor
A new instance of KeyNode.
Constructor Details
#initialize(key) ⇒ KeyNode
Returns a new instance of KeyNode.
103 104 105 |
# File 'lib/logstash/string_interpolation.rb', line 103 def initialize(key) @key = key end |
Instance Method Details
#evaluate(event) ⇒ Object
107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/logstash/string_interpolation.rb', line 107 def evaluate(event) value = event[@key] case value when nil "%{#{@key}}" when Array value.join(",") when Hash LogStash::Json.dump(value) else value end end |