[FileTree] Sort children

parent ee6c7297
...@@ -5,7 +5,7 @@ module FileTree ...@@ -5,7 +5,7 @@ module FileTree
path = Pathname(path) path = Pathname(path)
indentation = ' ' * depth * 2 indentation = ' ' * depth * 2
tree = indentation << path.to_path << "\n" tree = indentation << path.to_path << "\n"
path.children.each do |child| path.children.sort_by { |p| p.to_s.downcase }.each do |child|
tree << to_tree(child, depth + 1) tree << to_tree(child, depth + 1)
end if path.directory? end if path.directory?
tree tree
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment