lib/string_doc.rb in pakyow-presenter-1.0.1 vs lib/string_doc.rb in pakyow-presenter-1.0.2
- old
+ new
@@ -442,12 +442,16 @@
alias :to_xml :render
# Returns the node as an xml string, without transforming.
#
def to_s
- @nodes.each_with_object(String.new) do |node, string|
- string << node.to_s
+ if collapsed && empty?
+ collapsed
+ else
+ @nodes.each_with_object(String.new) do |node, string|
+ string << node.to_s
+ end
end
end
def ==(other)
other.is_a?(StringDoc) && @nodes == other.nodes
@@ -457,10 +461,10 @@
if significance?(*significance)
@nodes.each do |node|
node.children.collapse(*significance)
end
else
- @collapsed = to_xml
+ @collapsed = render
@nodes = []
end
@collapsed
end