class Fluent::Config::DSL::Proxy

Public Class Methods

new(name, arg, include_basepath = Dir.pwd) click to toggle source
# File lib/fluent/config/dsl.rb, line 40
def initialize(name, arg, include_basepath = Dir.pwd)
  @element = Element.new(name, arg, self)
  @include_basepath = include_basepath
end

Public Instance Methods

add_element(name, arg, block) click to toggle source
# File lib/fluent/config/dsl.rb, line 64
def add_element(name, arg, block)
  ::Kernel.raise ::ArgumentError, "#{name} block must be specified" if block.nil?

  proxy = self.class.new(name.to_s, arg)
  proxy.element.instance_exec(&block)

  @element.instance_eval do
    @elements.push(proxy.to_config_element)
  end

  self
end
element() click to toggle source
# File lib/fluent/config/dsl.rb, line 45
def element
  @element
end
eval(source, source_path) click to toggle source
# File lib/fluent/config/dsl.rb, line 53
def eval(source, source_path)
  @element.instance_eval(source, source_path)
  self
end
include_basepath() click to toggle source
# File lib/fluent/config/dsl.rb, line 49
def include_basepath
  @include_basepath
end
to_config_element() click to toggle source
# File lib/fluent/config/dsl.rb, line 58
def to_config_element
  @element.instance_eval do
    Config::Element.new(@name, @arg, @attrs, @elements)
  end
end