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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a5dc03dba0d176271e0c6c434bebb77c37839d6b
4
- data.tar.gz: 7a0d3cffefadf3428d07a00284de1ec1cc85939d
3
+ metadata.gz: 3342aa4f09d39ec0e5c7c784e89efa7c13fcd648
4
+ data.tar.gz: 1f5407ab67608b7c30a9b95c83a76af3538d06bc
5
5
  SHA512:
6
- metadata.gz: 2467eb61030682522223291cb5b6f1f43cbb446600a7831852375ed7cc0108798f99ca5cb1b46f442930d05d644c4f7cb72f30835fde00e541ea27bf7521a20c
7
- data.tar.gz: 2dbeec359709d42235a86935ebb74982c95b7a602e37fb329934e837803bcb8ff52449e3eba1594b089d52052f2c25206d8cc4afcea2536de26d8bf952f72d2e
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 "^#{File.join *array[0, root_depth]}/?"
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 |full_path|
50
- rel_dir = File.dirname full_path.sub(root_regex, '')
51
- abs_path = self.root.join(full_path)
52
- file_const_name = Utils.camelize File.basename(full_path).sub(RB_EXT, '')
53
- mod = modules.fetch rel_dir
54
- mod.autoload file_const_name, abs_path
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
@@ -1,4 +1,4 @@
1
1
  module AwesomeLoader
2
2
  # Library version
3
- VERSION = '0.0.1'.freeze
3
+ VERSION = '0.0.2'.freeze
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awesome_loader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordan Hollinger