class Fluent::Config::DSL::Element

def self.const_missing(name)

def self.const_missing(name)
  return ::Kernel.const_get(name) if ::Kernel.const_defined?(name)
  if name.to_s =~ /^Fluent::Config::DSL::Element::(.*)$/
    name = "#{$1}".to_sym
    return ::Kernel.const_get(name) if ::Kernel.const_defined?(name)
  end
  ::Kernel.eval("#{name}")
end

def include(*args)

def include(*args)
  ::Kernel.raise ::ArgumentError, "#{name} block requires arguments for include path" if args.nil? || args.size != 1
  if args.first =~ /\.rb$/
    path = File.expand_path(args.first)
    data = File.read(path)
    self.instance_eval(data, path)
  else
    ss = StringScanner.new('')
    Config::V1Parser.new(ss, @proxy.include_basepath, '', nil).eval_include(@attrs, @elements, args.first)
  end
end

def initialize(name, arg, proxy)

def initialize(name, arg, proxy)
  @name     = name
  @arg      = arg || ''
  @attrs    = {}
  @elements = []
  @proxy    = proxy
end

def match(*args, &block)

def match(*args, &block)
  ::Kernel.raise ::ArgumentError, "#{name} block requires arguments for match pattern" if args.nil? || args.size != 1
  @proxy.add_element('match', args.first, block)
end

def method_missing(name, *args, &block)

def method_missing(name, *args, &block)
  ::Kernel.raise ::ArgumentError, "Configuration DSL Syntax Error: only one argument allowed" if args.size > 1
  value = args.first
  if block
    proxy = Proxy.new(name.to_s, value)
    proxy.element.instance_exec(&block)
    @elements.push(proxy.to_config_element)
  else
    param_name = RESERVED_PARAMETERS.include?(name) ? "@#{name}" : name.to_s
    @attrs[param_name] = if value.is_a?(Array) || value.is_a?(Hash)
                           JSON.dump(value)
                         else
                           value.to_s
                         end
  end
  self
end

def ruby(&block)

def ruby(&block)
  if block
    @proxy.instance_exec(&block)
  else
    ::Kernel
  end
end

def source(&block)

def source(&block)
  @proxy.add_element('source', nil, block)
end

def to_int

def to_int
  __id__
end