Sha256: 461ad01c6b7f05177d92c129a4c3208ecd66fe26627347ec044004e6177298d6

Contents?: true

Size: 688 Bytes

Versions: 42

Compression:

Stored size: 688 Bytes

Contents

require "fluent/config/v1_parser"

class Fluentd
  class Agent
    class Configuration
      include Enumerable

      attr_reader :file

      def initialize(config_file)
        @file = config_file
      end

      def config
        @config ||= ::Fluent::Config::V1Parser.parse(File.read(file), File.basename(file), File.dirname(file))
      end

      def to_s
        config.to_s.gsub(/\A<ROOT>\n/, "").gsub(/<\/ROOT>\n\z/, "").gsub(/^ {2}/, "")
      end

      def each(&block)
        config.each_element(&block)
      end

      def sources
        find_all{|e| e.name == "source"}
      end

      def matches
        find_all{|e| e.name == "match"}
      end
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
fluentd-ui-1.2.1 app/models/fluentd/agent/configuration.rb
fluentd-ui-1.2.0 app/models/fluentd/agent/configuration.rb
fluentd-ui-1.1.0 app/models/fluentd/agent/configuration.rb
fluentd-ui-1.0.1 app/models/fluentd/agent/configuration.rb
fluentd-ui-1.0.0 app/models/fluentd/agent/configuration.rb
fluentd-ui-1.0.0.beta.1 app/models/fluentd/agent/configuration.rb
fluentd-ui-1.0.0.alpha.3 app/models/fluentd/agent/configuration.rb
fluentd-ui-1.0.0.alpha.2 app/models/fluentd/agent/configuration.rb
fluentd-ui-1.0.0.alpha.1 app/models/fluentd/agent/configuration.rb
fluentd-ui-0.4.5 app/models/fluentd/agent/configuration.rb
fluentd-ui-0.4.4 app/models/fluentd/agent/configuration.rb
fluentd-ui-0.4.3 app/models/fluentd/agent/configuration.rb
fluentd-ui-0.4.2 app/models/fluentd/agent/configuration.rb
fluentd-ui-0.4.1 app/models/fluentd/agent/configuration.rb
fluentd-ui-0.4.0 app/models/fluentd/agent/configuration.rb
fluentd-ui-0.3.21 app/models/fluentd/agent/configuration.rb
fluentd-ui-0.3.20 app/models/fluentd/agent/configuration.rb
fluentd-ui-0.3.19 app/models/fluentd/agent/configuration.rb
fluentd-ui-0.3.18 app/models/fluentd/agent/configuration.rb
fluentd-ui-0.3.17 app/models/fluentd/agent/configuration.rb