class Fluent::Test::Driver::BaseOwned

Attributes

section_name[RW]

Public Class Methods

new(klass, opts: {}, &block) click to toggle source
Calls superclass method Fluent::Test::Driver::Base::new
# File lib/fluent/test/driver/base_owned.rb, line 36
def initialize(klass, opts: {}, &block)
  super

  owner = OwnerDummy.new
  if opts
    owner.system_config_override(opts)
  end
  owner.log = TestLogger.new

  if @instance.respond_to?(:owner=)
    @instance.owner = owner
    if opts
      @instance.system_config_override(opts)
    end
  end

  @logs = owner.log.out.logs
  @section_name = ''
end

Public Instance Methods

configure(conf, syntax: :v1) click to toggle source
# File lib/fluent/test/driver/base_owned.rb, line 56
def configure(conf, syntax: :v1)
  if conf.is_a?(Fluent::Config::Element)
    @config = conf
  elsif conf.is_a?(Hash)
    @config = Fluent::Config::Element.new(@section_name, "", Hash[conf.map{|k,v| [k.to_s, v]}], [])
  else
    @config = Fluent::Config.parse(conf, @section_name, "", syntax: syntax)
  end
  @instance.configure(@config)
  self
end