folder-structure 0.1.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0c5a9571c9893602460dbb00fd2dd86abc22495acf67e70531770922cf23910d
4
- data.tar.gz: 0ef67847ae38adeb9a78dd23a6571e873bb497cc858cfa647dc9505b80548f77
3
+ metadata.gz: f46803bb90f1599f0288896c4477a4999dfbcb3856d6867638a06f4f7312e340
4
+ data.tar.gz: 164c43b799ce64ed09902fcabe41e5c90618732b20f9c5545bd90b32e82ae990
5
5
  SHA512:
6
- metadata.gz: 62748ed9046970593a65c8c682322b3b8014b388432d58a1cf6336648db15fdce58d37c92121bcab05e00e8d6c4e3c8847ebdef7933e1580ec347b74da61fd4e
7
- data.tar.gz: cc56033372f218dfb304ad59902ddf7010ac1ab24de9aeafce6d0dcdd2686ff2fc802bae50d9f24ef84b40e765b5f96798f441285d0058e77249b2e085bdada2
6
+ metadata.gz: 1b442f6a95182582cec0975ecd3d40f83ebe1d32b0f1001ff332855874f90a83e25eac5f7caee102d711509ac7cbb24781c893b15d0bb2aeb3e62b78f8197e92
7
+ data.tar.gz: a398baaef1ed40e2573d3145cf49e90e52be85a17edd58a41480279262a34bdd715e358bb54be5656a440974a3d392d264fcd5a46a61e73ab9db0f5397784631
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Folder
4
4
  module Structure
5
- VERSION = "0.1.0"
5
+ VERSION = "1.0.0"
6
6
  end
7
7
  end
@@ -6,8 +6,32 @@ module Folder
6
6
  module Structure
7
7
  class Error < StandardError; end
8
8
  # Your code goes here...
9
- def self.print_structure
10
- Dir.pwd
11
- end
12
- end
9
+ def self.print_structure(path = Dir.pwd, prefix = "")
10
+ entries = Dir.children(path).reject { |e| e.start_with?(".") }.sort
11
+ print_entries(entries, path, prefix)
12
+ end
13
+
14
+ def self.print_structure_with_hidden(path = Dir.pwd, prefix = "")
15
+ entries = Dir.children(path).sort
16
+ print_entries(entries, path, prefix)
17
+ end
18
+
19
+ def self.print_entries(entries, path, prefix)
20
+ entries.each_with_index do |entry, index|
21
+ full_path = File.join(path, entry)
22
+ is_last = index == entries.length - 1
23
+ connector = is_last ? "└── " : "├── "
24
+ puts "#{prefix}#{connector}#{entry}"
25
+
26
+ if File.directory?(full_path)
27
+ new_prefix = prefix + (is_last ? " " : "│ ")
28
+ print_structure_with_hidden(full_path, new_prefix) if respond_to?(:print_structure_with_hidden)
29
+ print_structure(full_path, new_prefix) if respond_to?(:print_structure) && !entry.start_with?(".")
30
+ end
31
+ end
32
+ end
33
+
34
+
35
+
36
+ end
13
37
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: folder-structure
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mooventhan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-08-04 00:00:00.000000000 Z
11
+ date: 2025-08-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: ''
14
14
  email: