Class/Module Index [+]

Quicksearch

Fluent::Config

Public Class Methods

bool_value(str) click to toggle source
# File lib/fluent/config/types.rb, line 51
def self.bool_value(str)
  return nil if str.nil?
  case str.to_s
  when 'true', 'yes'
    true
  when 'false', 'no'
    false
  when ''
    true
  else
    nil
  end
end
new(name = '') click to toggle source
# File lib/fluent/config.rb, line 37
def self.new(name = '')
  Element.new(name, '', {}, [])
end
parse(str, fname, basepath = Dir.pwd, v1_config = false) click to toggle source
# File lib/fluent/config.rb, line 22
def self.parse(str, fname, basepath = Dir.pwd, v1_config = false)
  if fname =~ /\.rb$/
    require 'fluent/config/dsl'
    Config::DSL::Parser.parse(str, File.join(basepath, fname))
  else
    if v1_config
      require 'fluent/config/v1_parser'
      V1Parser.parse(str, fname, basepath, Kernel.binding)
    else
      require 'fluent/config/parser'
      Parser.parse(str, fname, basepath)
    end
  end
end
size_value(str) click to toggle source
# File lib/fluent/config/types.rb, line 21
def self.size_value(str)
  case str.to_s
  when /([0-9]+)k/
    $~[1].to_i * 1024
  when /([0-9]+)m/
    $~[1].to_i * (1024 ** 2)
  when /([0-9]+)g/
    $~[1].to_i * (1024 ** 3)
  when /([0-9]+)t/
    $~[1].to_i * (1024 ** 4)
  else
    str.to_i
  end
end
time_value(str) click to toggle source
# File lib/fluent/config/types.rb, line 36
def self.time_value(str)
  case str.to_s
  when /([0-9]+)s/
    $~[1].to_i
  when /([0-9]+)m/
    $~[1].to_i * 60
  when /([0-9]+)h/
    $~[1].to_i * 60 * 60
  when /([0-9]+)d/
    $~[1].to_i * 24 * 60 * 60
  else
    str.to_f
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.