class Fluent::Test::Driver::Filter
Attributes
filtered[R]
Public Class Methods
new(klass, opts: {}, &block)
click to toggle source
Calls superclass method
Fluent::Test::Driver::EventFeeder.new
# File lib/fluent/test/driver/filter.rb, line 30 def initialize(klass, opts: {}, &block) super raise ArgumentError, "plugin is not an instance of Fluent::Plugin::Filter" unless @instance.is_a? Fluent::Plugin::Filter @filtered = [] end
Public Instance Methods
filtered_records()
click to toggle source
# File lib/fluent/test/driver/filter.rb, line 36 def filtered_records @filtered.map {|_time, record| record } end
instance_hook_after_started()
click to toggle source
Calls superclass method
Fluent::Test::Driver::Base#instance_hook_after_started
# File lib/fluent/test/driver/filter.rb, line 40 def instance_hook_after_started super filter_hook = ->(time, record) { @filtered << [time, record] } m = Module.new do define_method(:filter_stream) do |tag, es| new_es = super(tag, es) new_es.each do |time, record| filter_hook.call(time, record) end new_es end end @instance.singleton_class.prepend(m) end