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 +4 -4
- data/README.md +10 -11
- data/lib/lazy_require.rb +2 -0
- data/lib/lazy_require/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2949b4e0b39e9346e866046e4a6081c28433e358
|
4
|
+
data.tar.gz: 099deb512214a0d5fb74418365af046f31da005a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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.
|
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 :
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
from
|
108
|
-
|
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.
|
119
|
+
LazyRequire.require(files)
|
121
120
|
#=> true
|
122
121
|
```
|
123
122
|
|
data/lib/lazy_require.rb
CHANGED
data/lib/lazy_require/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2016-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|