Class: Fluent::Config::YamlParser::SectionBuilder
- Inherits:
-
Struct
- Object
- Struct
- Fluent::Config::YamlParser::SectionBuilder
- Defined in:
- lib/fluent/config/yaml_parser/section_builder.rb
Instance Attribute Summary collapse
-
#arg ⇒ Object
Returns the value of attribute arg.
-
#body ⇒ Object
Returns the value of attribute body.
-
#indent_size ⇒ Object
Returns the value of attribute indent_size.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
Instance Attribute Details
#arg ⇒ Object
Returns the value of attribute arg
20 21 22 |
# File 'lib/fluent/config/yaml_parser/section_builder.rb', line 20 def arg @arg end |
#body ⇒ Object
Returns the value of attribute body
20 21 22 |
# File 'lib/fluent/config/yaml_parser/section_builder.rb', line 20 def body @body end |
#indent_size ⇒ Object
Returns the value of attribute indent_size
20 21 22 |
# File 'lib/fluent/config/yaml_parser/section_builder.rb', line 20 def indent_size @indent_size end |
#name ⇒ Object
Returns the value of attribute name
20 21 22 |
# File 'lib/fluent/config/yaml_parser/section_builder.rb', line 20 def name @name end |
Instance Method Details
#to_element ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/fluent/config/yaml_parser/section_builder.rb', line 31 def to_element elem = body.to_element elem.name = name elem.arg = arg.to_s if arg elem.v1_config = true elem end |
#to_s ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/fluent/config/yaml_parser/section_builder.rb', line 21 def to_s indent = ' ' * indent_size if arg && !arg.to_s.empty? "#{indent}<#{name} #{arg}>\n#{body}\n#{indent}</#{name}>" else "#{indent}<#{name}>\n#{body}\n#{indent}</#{name}>" end end |