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_msgpack_stream, #to_msgpack_stream_forced_integer

Methods included from MessagePackFactory::Mixin

#msgpack_factory, #msgpack_packer, #msgpack_unpacker

Constructor Details

#initialize(entries) ⇒ ArrayEventStream

Returns a new instance of ArrayEventStream.



110
111
112
# File 'lib/fluent/event.rb', line 110

def initialize(entries)
  @entries = entries
end

Instance Method Details

#dupObject



114
115
116
117
# File 'lib/fluent/event.rb', line 114

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

#each(&block) ⇒ Object



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

def each(&block)
  @entries.each(&block)
  nil
end

#empty?Boolean

Returns:

  • (Boolean)


127
128
129
# File 'lib/fluent/event.rb', line 127

def empty?
  @entries.empty?
end

#repeatable?Boolean

Returns:

  • (Boolean)


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

def repeatable?
  true
end

#sizeObject



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

def size
  @entries.size
end

#slice(index, num) ⇒ Object



131
132
133
# File 'lib/fluent/event.rb', line 131

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