Class/Module Index [+]

Quicksearch

Fluent::Test::FilterTestDriver

Attributes

filtered[R]
tag[RW]

Public Class Methods

new(klass, tag = 'filter.test', &block) click to toggle source
# File lib/fluent/test/filter_test.rb, line 20
def initialize(klass, tag = 'filter.test', &block)
  super(klass, &block)
  @tag = tag
  @events = {}
  @filtered = MultiEventStream.new
end

Public Instance Methods

emit(record, time = Engine.now) click to toggle source
# File lib/fluent/test/filter_test.rb, line 30
def emit(record, time = Engine.now)
  emit_with_tag(@tag, record, time)
end
Also aliased as: filter
emit_with_tag(tag, record, time = Engine.now) click to toggle source
# File lib/fluent/test/filter_test.rb, line 35
def emit_with_tag(tag, record, time = Engine.now)
  @events[tag] ||= MultiEventStream.new
  @events[tag].add(time, record)
end
Also aliased as: filter_with_tag
emits() click to toggle source
Alias for: filtered_as_array
filter(record, time = Engine.now) click to toggle source
Alias for: emit
filter_stream(es) click to toggle source
# File lib/fluent/test/filter_test.rb, line 41
def filter_stream(es)
  filter_stream_with_tag(@tag, es)
end
filter_stream_with_tag(tag, es) click to toggle source
# File lib/fluent/test/filter_test.rb, line 45
def filter_stream_with_tag(tag, es)
  @events[tag] = es
end
filter_with_tag(tag, record, time = Engine.now) click to toggle source
Alias for: emit_with_tag
filtered_as_array() click to toggle source
# File lib/fluent/test/filter_test.rb, line 49
def filtered_as_array
  all = []
  @filtered.each { |time, record|
    all << [@tag, time, record]
  }
  all
end
Also aliased as: emits
run(num_waits = 0, &block) click to toggle source

Almost filters don't use threads so default is 0. It reduces test time.

# File lib/fluent/test/filter_test.rb, line 59
def run(num_waits = 0, &block)
  super(num_waits) {
    block.call if block

    @events.each { |tag, es|
      processed = @instance.filter_stream(tag, es)
      processed.each { |time, record|
        @filtered.add(time, record)
      }
    }
  }
  self
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.