lib/brief/tree.rb in brief-0.0.2 vs lib/brief/tree.rb in brief-0.0.3

- old
+ new

@@ -14,12 +14,13 @@ only = node.except(:children) visitor = lambda do |child| c_only = child.except(:children) g_children = Array(child[:children]) - g_children = nil if g_children.length == 0 g_children.each {|gchild| gchild.parent_id = c_only.id} + + g_children = nil if g_children.length == 0 [c_only, g_children].compact end children = Array(node[:children]).map(&visitor).flatten