Class: Fluent::ArrayEventStream

Inherits:
EventStream show all
Defined in:
lib/fluent/event.rb

Overview

EventStream from entries: Array of [time, record]

Use this class for many events data with a tag and its representation is [ [time, record], [time, record], .. ]

Instance Method Summary collapse

Methods inherited from EventStream

#==, #to_compressed_msgpack_stream, #to_msgpack_stream, #to_msgpack_stream_forced_integer

Methods included from Plugin::Compressable

#compress, #decompress

Constructor Details

#initialize(entries) ⇒ ArrayEventStream

Returns a new instance of ArrayEventStream.



120
121
122
# File 'lib/fluent/event.rb', line 120

def initialize(entries)
  @entries = entries
end

Instance Method Details

#dupObject



124
125
126
127
# File 'lib/fluent/event.rb', line 124

def dup
  entries = @entries.map{ |time, record| [time, record.dup] }
  ArrayEventStream.new(entries)
end

#each(unpacker: nil, &block) ⇒ Object



145
146
147
148
# File 'lib/fluent/event.rb', line 145

def each(unpacker: nil, &block)
  @entries.each(&block)
  nil
end

#empty?Boolean

Returns:

  • (Boolean)


137
138
139
# File 'lib/fluent/event.rb', line 137

def empty?
  @entries.empty?
end

#repeatable?Boolean

Returns:

  • (Boolean)


133
134
135
# File 'lib/fluent/event.rb', line 133

def repeatable?
  true
end

#sizeObject



129
130
131
# File 'lib/fluent/event.rb', line 129

def size
  @entries.size
end

#slice(index, num) ⇒ Object



141
142
143
# File 'lib/fluent/event.rb', line 141

def slice(index, num)
  ArrayEventStream.new(@entries.slice(index, num))
end