Class: Fluentd::Setting::Config
- Inherits:
-
Object
- Object
- Fluentd::Setting::Config
- Defined in:
- app/models/fluentd/setting/config.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#fl_config ⇒ Object
readonly
Returns the value of attribute fl_config.
Instance Method Summary collapse
- #empty? ⇒ Boolean
- #formatted ⇒ Object
-
#initialize(config_file) ⇒ Config
constructor
A new instance of Config.
- #matches ⇒ Object
- #sources ⇒ Object
- #write_to_file ⇒ Object
Constructor Details
#initialize(config_file) ⇒ Config
Returns a new instance of Config.
9 10 11 12 |
# File 'app/models/fluentd/setting/config.rb', line 9 def initialize(config_file) @fl_config = Fluent::Config.parse(IO.read(config_file), config_file, nil, true) @file = config_file end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
6 7 8 |
# File 'app/models/fluentd/setting/config.rb', line 6 def file @file end |
#fl_config ⇒ Object (readonly)
Returns the value of attribute fl_config.
6 7 8 |
# File 'app/models/fluentd/setting/config.rb', line 6 def fl_config @fl_config end |
Instance Method Details
#empty? ⇒ Boolean
14 15 16 |
# File 'app/models/fluentd/setting/config.rb', line 14 def empty? elements.length.zero? end |
#formatted ⇒ Object
35 36 37 |
# File 'app/models/fluentd/setting/config.rb', line 35 def formatted fl_config.to_s.gsub(/<\/?ROOT>/, "").strip_heredoc.gsub(%r|^</.*?>$|, "\\0\n") end |
#matches ⇒ Object
24 25 26 27 28 |
# File 'app/models/fluentd/setting/config.rb', line 24 def matches elements.find_all do |elm| elm.name == "match" end end |
#sources ⇒ Object
18 19 20 21 22 |
# File 'app/models/fluentd/setting/config.rb', line 18 def sources elements.find_all do |elm| elm.name == "source" end end |