Class: Fluent::Config::DSL::Proxy

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/config/dsl.rb

Instance Method Summary collapse

Constructor Details

#initialize(name, arg, include_basepath = Dir.pwd) ⇒ Proxy

Returns a new instance of Proxy.



40
41
42
43
# 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

Instance Method Details

#add_element(name, arg, block) ⇒ Object



64
65
66
67
68
69
70
71
72
73
74
75
# 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

#elementObject



45
46
47
# File 'lib/fluent/config/dsl.rb', line 45

def element
  @element
end

#eval(source, source_path) ⇒ Object



53
54
55
56
# File 'lib/fluent/config/dsl.rb', line 53

def eval(source, source_path)
  @element.instance_eval(source, source_path)
  self
end

#include_basepathObject



49
50
51
# File 'lib/fluent/config/dsl.rb', line 49

def include_basepath
  @include_basepath
end

#to_config_elementObject



58
59
60
61
62
# 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