summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2015-04-08 11:41:36 -0600
committermo khan <mo@mokhan.ca>2015-04-08 11:41:36 -0600
commit2ce6f7750e1fe761441d8a05bf0cf61f5214a0f8 (patch)
tree2f1e5e838fabec56cf0f02e42c893fef86efadbc
parent765509c40c7fc5f556151a0ef046fdec11e5e868 (diff)
extract common append_to interface.
-rw-r--r--lib/scale/svg.rb14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/scale/svg.rb b/lib/scale/svg.rb
index f34b16b..7eb39b9 100644
--- a/lib/scale/svg.rb
+++ b/lib/scale/svg.rb
@@ -15,15 +15,19 @@ module Scale
def to_xml
builder = Nokogiri::XML::Builder.new do |xml|
- xml.svg(attributes) do
- @children.each do |node|
- node.append_to(xml)
- end
- end
+ append_to(xml)
end
builder.to_xml
end
+ def append_to(xml)
+ xml.svg(attributes) do
+ @children.each do |node|
+ node.append_to(xml)
+ end
+ end
+ end
+
private
def attributes