renumber 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/renumber/version.rb +1 -1
- data/lib/renumber.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d5ae0d70453c1927e42ab1d872cfd5fcad84619
|
4
|
+
data.tar.gz: 29772e091d357bd3eaeca9cd650ec93c95de2c25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c88b6b82c43dc285e5eaba61782f7b82945318928d0782280bc24fe639af9b20273fca746f5d7e292c1f51f8fb03e35586cf3174548be31edcd11f8feafe9e5a
|
7
|
+
data.tar.gz: 2e379521ffb75438279d4aefd6fec576eaa42706ec17996704d5629a100dbf4c0253ccef80c7b79272554bbc958d57844cc36a2fedf5428cd118088de4017e3e
|
data/lib/renumber/version.rb
CHANGED
data/lib/renumber.rb
CHANGED
@@ -4,6 +4,8 @@ module Renumber
|
|
4
4
|
def sorted_files(path)
|
5
5
|
raise ArgumentError, 'path must be a directory' unless File.directory?(path)
|
6
6
|
|
7
|
+
Dir.chdir(path)
|
8
|
+
|
7
9
|
file_entries_from_path(path).sort
|
8
10
|
end
|
9
11
|
|
@@ -11,8 +13,6 @@ module Renumber
|
|
11
13
|
sorted_files = sorted_files(path)
|
12
14
|
return if sorted_files.length == 0
|
13
15
|
|
14
|
-
Dir.chdir(path)
|
15
|
-
|
16
16
|
zeros_length = Math.log10(sorted_files.length).ceil
|
17
17
|
|
18
18
|
sorted_files.each_with_index do |file, index|
|