summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/scale/node.rb21
1 files changed, 10 insertions, 11 deletions
diff --git a/lib/scale/node.rb b/lib/scale/node.rb
index 00b3b7c..c71d589 100644
--- a/lib/scale/node.rb
+++ b/lib/scale/node.rb
@@ -28,17 +28,9 @@ module Scale
end
def append_to(builder)
- if content.nil?
- builder.send(xml_tag.to_sym, xml_attributes) do
- each do |node|
- node.append_to(builder)
- end
- end
- else
- builder.send(xml_tag.to_sym, content, xml_attributes) do
- each do |node|
- node.append_to(builder)
- end
+ builder.send(xml_tag.to_sym, *xml_parameters) do
+ each do |node|
+ node.append_to(builder)
end
end
end
@@ -46,5 +38,12 @@ module Scale
def xml_attributes
attributes.delete_if { |key, value| value.nil? }
end
+
+ private
+
+ def xml_parameters
+ return [xml_attributes] if content.nil?
+ [content, xml_attributes]
+ end
end
end