Refactor: Config#config -> Config#fl_config

This commit is contained in:
uu59 2014-11-25 17:43:11 +09:00
parent 4bc6743841
commit 645c2bbefc

View File

@ -3,26 +3,26 @@ require 'fluent/config'
class Fluentd class Fluentd
module Setting module Setting
class Config class Config
attr_reader :config, :file attr_reader :fl_config, :file
delegate :elements, :to_s, to: :fl_config
def initialize(config_file) def initialize(config_file)
config = Fluent::Config.parse(IO.read(config_file), config_file, nil, true) @fl_config = Fluent::Config.parse(IO.read(config_file), config_file, nil, true)
@config = config
@file = config_file @file = config_file
end end
def empty? def empty?
config.elements.length.zero? elements.length.zero?
end end
def sources def sources
config.elements.find_all do |elm| elements.find_all do |elm|
elm.name == "source" elm.name == "source"
end end
end end
def matches def matches
config.elements.find_all do |elm| elements.find_all do |elm|
elm.name == "match" elm.name == "match"
end end
end end