Class: Fluent::MessagePackFormattedBufferData

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/plugin/buf_event_limited.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#dataObject (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_eventsObject



16
17
18
# File 'lib/fluent/plugin/buf_event_limited.rb', line 16

def as_events
  records.dup
end

#recordsObject



12
13
14
# File 'lib/fluent/plugin/buf_event_limited.rb', line 12

def records
  @records ||= (data.empty? ? [] : unpack(data)).freeze
end

#sizeObject



20
21
22
# File 'lib/fluent/plugin/buf_event_limited.rb', line 20

def size
  @size ||= records.size
end