Class: Fluent::UnitTimeFilterOutput::Buffer

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/fluent/plugin/unit_time_filter_buffer.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Buffer

Returns a new instance of Buffer.



5
6
7
8
9
10
11
12
13
14
# File 'lib/fluent/plugin/unit_time_filter_buffer.rb', line 5

def initialize(options)
  @log = options[:log]

  @fiber = Fiber.new do
    run(options)
  end

  # Step to `yield`
  @fiber.resume
end

Instance Method Details

#eachObject



16
17
18
19
20
21
22
23
24
25
# File 'lib/fluent/plugin/unit_time_filter_buffer.rb', line 16

def each
  loop do
    tag, es = Fiber.yield
    break unless (tag && es)

    es.each do |time, record|
      yield([tag, time, record])
    end
  end
end

#resume(tag, es) ⇒ Object



27
28
29
# File 'lib/fluent/plugin/unit_time_filter_buffer.rb', line 27

def resume(tag, es)
  @fiber.resume(tag, es)
end