lib/spoom/file_tree.rb in spoom-1.1.11 vs lib/spoom/file_tree.rb in spoom-1.1.12

- old
+ new

@@ -31,10 +31,11 @@ path = path.delete_prefix("#{prefix}/") if prefix parts = path.split("/") if path.empty? || parts.size == 1 return @roots[path] ||= Node.new(parent: nil, name: path) end + parent_path = T.must(parts[0...-1]).join("/") parent = add_path(parent_path) name = T.must(parts.last) parent.children[name] ||= Node.new(parent: parent, name: name) end @@ -103,9 +104,10 @@ # Full path to this node from root sig { returns(String) } def path parent = self.parent return name unless parent + "#{parent.path}/#{name}" end end # An internal class used to print a FileTree