Module: Fluent::ExtConfig

Defined in:
lib/fluent/format/format.rb

Class Method Summary collapse

Class Method Details

.parse(io, fname, basepath = Dir.pwd) ⇒ String

Extended to accept config dsl

Returns:

  • (String)

    parsed config string

Raises:

  • Fluent::ConfigParseError if conf has syntax errors

  • Fluent::ConfigError if plugin raises config error



53
54
55
56
57
58
59
# File 'lib/fluent/format/format.rb', line 53

def self.parse(io, fname, basepath=Dir.pwd)
  if fname =~ /\.rb$/
    Fluent::Config::DSL::Parser.parse(io, File.join(basepath, fname))
  else
    Fluent::Config.parse(io, fname, basepath)
  end
end

.read(dev) ⇒ String

Extended to accept IO object

Returns:

  • (String)

    parsed config string

Raises:

  • Fluent::ConfigParseError if conf has syntax errors

  • Fluent::ConfigError if plugin raises config error



40
41
42
43
44
45
46
# File 'lib/fluent/format/format.rb', line 40

def self.read(dev)
  if dev.respond_to?(:read) # IO object
    parse(dev, '-', '-')
  else
    File.open(dev) {|io| parse(io, File.basename(dev), File.dirname(dev)) }
  end
end