Class: Fluent::MessagePackFormattedBufferData
- Inherits:
-
Object
- Object
- Fluent::MessagePackFormattedBufferData
- Defined in:
- lib/fluent/plugin/buf_event_limited.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
(also: #to_str, #as_msg_pack)
readonly
Returns the value of attribute data.
Instance Method Summary collapse
- #as_events ⇒ Object
-
#initialize(data) ⇒ MessagePackFormattedBufferData
constructor
A new instance of MessagePackFormattedBufferData.
- #records ⇒ Object
- #size ⇒ Object
Constructor Details
#initialize(data) ⇒ MessagePackFormattedBufferData
Returns a new instance of MessagePackFormattedBufferData.
8 9 10 |
# File 'lib/fluent/plugin/buf_event_limited.rb', line 8 def initialize(data) @data = data.to_str.freeze end |
Instance Attribute Details
#data ⇒ Object (readonly) Also known as: to_str, as_msg_pack
Returns the value of attribute data.
6 7 8 |
# File 'lib/fluent/plugin/buf_event_limited.rb', line 6 def data @data end |
Instance Method Details
#as_events ⇒ Object
16 17 18 |
# File 'lib/fluent/plugin/buf_event_limited.rb', line 16 def as_events records.dup end |
#records ⇒ Object
12 13 14 |
# File 'lib/fluent/plugin/buf_event_limited.rb', line 12 def records @records ||= (data.empty? ? [] : unpack(data)).freeze end |
#size ⇒ Object
20 21 22 |
# File 'lib/fluent/plugin/buf_event_limited.rb', line 20 def size @size ||= records.size end |