Class: LogStash::Codecs::Spool
- Inherits:
-
Base
- Object
- Base
- LogStash::Codecs::Spool
- Defined in:
- lib/logstash/codecs/spool.rb
Instance Attribute Summary collapse
-
#buffer ⇒ Object
readonly
Returns the value of attribute buffer.
Instance Method Summary collapse
Instance Attribute Details
#buffer ⇒ Object (readonly)
Returns the value of attribute buffer.
8 9 10 |
# File 'lib/logstash/codecs/spool.rb', line 8 def buffer @buffer end |
Instance Method Details
#decode(data) ⇒ Object
11 12 13 14 15 |
# File 'lib/logstash/codecs/spool.rb', line 11 def decode(data) data.each do |event| yield event end end |
#encode(event) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/logstash/codecs/spool.rb', line 18 def encode(event) @buffer ||= [] #buffer size is hard coded for now until a #better way to pass args into codecs is implemented if @buffer.length >= @spool_size @on_event.call @buffer @buffer = [] else @buffer << event end end |
#teardown ⇒ Object
31 32 33 34 35 36 |
# File 'lib/logstash/codecs/spool.rb', line 31 def teardown if !@buffer.nil? and @buffer.length > 0 @on_event.call @buffer end @buffer = [] end |