Stop writing empty section

Signed-off-by: Kenji Okimoto <okimoto@clear-code.com>
This commit is contained in:
Kenji Okimoto 2018-06-20 12:57:23 +09:00
parent f29ff276b6
commit 00fcad0e1e
No known key found for this signature in database
GPG Key ID: F9E3E329A5C5E4A1

View File

@ -56,9 +56,11 @@ class Fluentd
next if section_params.blank? next if section_params.blank?
section_params.each do |index, _section_params| section_params.each do |index, _section_params|
sub_attrs, sub_elements = parse_attributes(_section_params) sub_attrs, sub_elements = parse_attributes(_section_params)
if sub_attrs.present? || sub_elements.present? # skip empty section
elements << config_element(key, "", sub_attrs, sub_elements) elements << config_element(key, "", sub_attrs, sub_elements)
end end
end end
end
return params.to_h.reject{|key, value| skip?(key.to_sym, value) }, elements return params.to_h.reject{|key, value| skip?(key.to_sym, value) }, elements
end end