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
module Setting
class Config
attr_reader :config, :file
attr_reader :fl_config, :file
delegate :elements, :to_s, to: :fl_config
def initialize(config_file)
config = Fluent::Config.parse(IO.read(config_file), config_file, nil, true)
@config = config
@fl_config = Fluent::Config.parse(IO.read(config_file), config_file, nil, true)
@file = config_file
end
def empty?
config.elements.length.zero?
elements.length.zero?
end
def sources
config.elements.find_all do |elm|
elements.find_all do |elm|
elm.name == "source"
end
end
def matches
config.elements.find_all do |elm|
elements.find_all do |elm|
elm.name == "match"
end
end