lib/makit/tree.rb in makit-0.0.26 vs lib/makit/tree.rb in makit-0.0.27
- old
+ new
@@ -1,37 +1,37 @@
-# frozen_string_literal: true
-
-# This module provides classes for the Makit gem.
-module Makit
- class Tree
- def get_source_tree
- files = `git ls-files`.split("\n")
- tree = {}
-
- # Build a nested hash representing the file structure
- files.each do |file|
- parts = file.split("/")
- current = tree
-
- parts.each_with_index do |part, index|
- current[part] ||= (index == parts.length - 1 ? nil : {})
- current = current[part] unless current[part].nil?
- end
- end
-
- generate_tree_string(tree)
- end
-
- def generate_tree_string(tree, indent = "")
- result = ""
- tree.each do |key, value|
- if value.is_a?(Hash)
- result << "#{indent}#{key}/\n"
- result << generate_tree_string(value, "#{indent} ")
- else
- result << "#{indent}#{key}\n"
- end
- end
- result
- end
- end
-end
+# frozen_string_literal: true
+
+# This module provides classes for the Makit gem.
+module Makit
+ class Tree
+ def get_source_tree
+ files = `git ls-files`.split("\n")
+ tree = {}
+
+ # Build a nested hash representing the file structure
+ files.each do |file|
+ parts = file.split("/")
+ current = tree
+
+ parts.each_with_index do |part, index|
+ current[part] ||= (index == parts.length - 1 ? nil : {})
+ current = current[part] unless current[part].nil?
+ end
+ end
+
+ generate_tree_string(tree)
+ end
+
+ def generate_tree_string(tree, indent = "")
+ result = ""
+ tree.each do |key, value|
+ if value.is_a?(Hash)
+ result << "#{indent}#{key}/\n"
+ result << generate_tree_string(value, "#{indent} ")
+ else
+ result << "#{indent}#{key}\n"
+ end
+ end
+ result
+ end
+ end
+end