awesome_loader 0.0.1 → 0.0.2
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 +4 -4
- data/lib/awesome_loader/autoloader.rb +7 -8
- data/lib/awesome_loader/version.rb +1 -1
- 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: 3342aa4f09d39ec0e5c7c784e89efa7c13fcd648
|
4
|
+
data.tar.gz: 1f5407ab67608b7c30a9b95c83a76af3538d06bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9e56691706e874b1f1485dfb5fec6d0f16b2019bee005db971c05f21fc7da7657ff574d758207a1d3b2280330aeef10af26d95512ad4832e98aa1ebcfe157cc
|
7
|
+
data.tar.gz: 7f8aa1136e030f5915cb43541b59a320fbba36b784e099b901eabe80cbe97a394442c0950323fcbb0c99d90cc0b1de1d92567c67ef223eab8691010dc9135ab9
|
@@ -26,7 +26,7 @@ module AwesomeLoader
|
|
26
26
|
|
27
27
|
def paths(array, root_depth: default_root_depth)
|
28
28
|
files = Dir.glob File.join *array
|
29
|
-
root_regex = Regexp.new "
|
29
|
+
root_regex = Regexp.new "^([^/]+/){%d}" % root_depth
|
30
30
|
|
31
31
|
# Get an array of nested dirs (parent dir always comes before child dir)
|
32
32
|
nested_dirs = files.
|
@@ -46,13 +46,12 @@ module AwesomeLoader
|
|
46
46
|
}
|
47
47
|
|
48
48
|
# For each file, look up it's dir module and set autoload on the class/module in the file.
|
49
|
-
files.each do |
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
mod
|
54
|
-
|
55
|
-
self.all_files << abs_path if eager_load
|
49
|
+
files.each do |path|
|
50
|
+
full_path = self.root.join(path)
|
51
|
+
const_name = Utils.camelize File.basename(path).sub(RB_EXT, '')
|
52
|
+
mod = modules.fetch File.dirname path.sub(root_regex, '')
|
53
|
+
mod.autoload const_name, full_path
|
54
|
+
self.all_files << full_path if eager_load
|
56
55
|
end
|
57
56
|
|
58
57
|
self
|