lazy_require 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 126e4dbfcad94a1ce5e9b68b9da5fc3572214a25
4
- data.tar.gz: 1b3ef93c27246fbf5d726a29b37f6c6ebd673c55
3
+ metadata.gz: 2949b4e0b39e9346e866046e4a6081c28433e358
4
+ data.tar.gz: 099deb512214a0d5fb74418365af046f31da005a
5
5
  SHA512:
6
- metadata.gz: b00987706a8588ed20b44128189a92cbddc1a67f130941d7820d1709258eb54f5096f60fd5fe31fc8e6798419aecab750a16db46cde9c1cfc333395d940f5bd8
7
- data.tar.gz: 10c9c68c904f010eb2e7ef987e5248a694d4dfcd90d5599d99626a726ac053152e94c9b91ffd21b810e3cb6a5d645ebbfb6c17e020c4742cd03a7fd128ad4a67
6
+ metadata.gz: 8ddea9f157bbbf7e793a8c3c4c591815e4c0c211d430bcf1d2a5dbc2c8d9aa872e93104dc136701112334055abf18b71a624be90b723b9f8b57d120e1944ca2e
7
+ data.tar.gz: 53a158f3f9dc182e303e884655e63854d8078519510050e5ab78e7bb4bc0283b5e132fffb9dbfe95f069d7bdaec27fa19f5f647c1a9edc510359d9c0d9c39094
data/README.md CHANGED
@@ -82,7 +82,7 @@ With **LazyRequire**, you can ask it to load all the files in your project/folde
82
82
  ```ruby
83
83
  # App.rb
84
84
 
85
- LazyRequire.load_all('./lib/**/*.rb')
85
+ LazyRequire.require_all('./lib/**/*.rb')
86
86
 
87
87
  class App
88
88
  # Some stuff here
@@ -92,21 +92,20 @@ end
92
92
  **LazyRequire.load_all()** accepts any glob pattern and will try to require all files that it finds with that glob pattern. If it it successfully loads all files it will return true:
93
93
 
94
94
  ```ruby
95
- 2.3.0 :010 > LazyRequire.load_all('./spec/support/load_all/**/*.rb')
95
+ 2.3.0 :010 > LazyRequire.require_all('./spec/support/load_all/**/*.rb')
96
96
  #=> true
97
97
  ```
98
98
 
99
99
  If it cannot load any of the files, it will raise an exception:
100
100
 
101
101
  ```ruby
102
- 2.3.0 :006 > LazyRequire.load_all('./spec/support/errors/**/*.rb')
103
- RuntimeError: Could not load files:
104
- ./spec/support/errors/top_two.rb
105
- ./spec/support/errors/top.rb
106
-
107
- from ../code/lazy_require/lib/lazy_require.rb:12:in `load'
108
- from ../code/lazy_require/lib/lazy_require.rb:22:in `load_all'
109
- from (irb):6
102
+ 2.3.0 :005 > LazyRequire.require(@files)
103
+ NameError: uninitialized constant Top
104
+ from /code/lazy_require/spec/support/errors/top_two.rb:2:in `<top (required)>'
105
+ from /code/lazy_require/lib/lazy_require.rb:13:in `require'
106
+ from /code/lazy_require/lib/lazy_require.rb:13:in `require'
107
+ from (irb):5
108
+
110
109
  ```
111
110
 
112
111
  If you want to load a specific collection of files and avoid using the glob pattern, you can do that to using the #load() method.
@@ -117,7 +116,7 @@ files = [
117
116
  './spec/support/errors/top.rb',
118
117
  ]
119
118
 
120
- LazyRequire.load(files)
119
+ LazyRequire.require(files)
121
120
  #=> true
122
121
  ```
123
122
 
@@ -7,6 +7,8 @@ module LazyRequire
7
7
 
8
8
  def require(files)
9
9
  files = toArray(files)
10
+ return unless files.length > 0
11
+
10
12
  failed_files = try_to_require(files)
11
13
 
12
14
  if failed_files.length == files.length
@@ -1,5 +1,5 @@
1
1
 
2
2
  module LazyRequire
3
- VERSION = "0.2.1"
3
+ VERSION = "0.2.2"
4
4
  end
5
5
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lazy_require
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Thomas
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-05-03 00:00:00.000000000 Z
11
+ date: 2016-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler