class Fluent::MultiEventStream
stream.add(time, record)
2. add events<br>streams ||= MultiEventStream.new
1. initialize blank stream:
Use this class as below, in loop of data-enumeration:
because this class generate less objects than ArrayEventStream.
This class can handle many events more efficiently than ArrayEventStream
EventStream from entries: numbers of pairs of time and record.
def add(time, record)
def add(time, record) @time_array << time @record_array << record end
def dup
def dup MultiEventStream.new(@time_array.dup, @record_array.map(&:dup)) end
def each(&block)
def each(&block) time_array = @time_array record_array = @record_array for i in 0..time_array.length-1 block.call(time_array[i], record_array[i]) end nil end
def empty?
def empty? @time_array.empty? end
def initialize(time_array = [], record_array = [])
def initialize(time_array = [], record_array = []) @time_array = time_array @record_array = record_array end
def repeatable?
def repeatable? true end
def size
def size @time_array.size end
def slice(index, num)
def slice(index, num) MultiEventStream.new(@time_array.slice(index, num), @record_array.slice(index, num)) end