faker_maker 1.1.3 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/faker_maker.rb +3 -3
- data/lib/faker_maker/base.rb +9 -4
- data/lib/faker_maker/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e4ab9d0a34167a7b16e6ee777d338f63398adcd44799975f0e48b4b62eae6a8
|
4
|
+
data.tar.gz: 67806c647397291ff25dcaf7a216bfde0ac9b9fec4d461907d84c0215cef297c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 842e0afa0e49d44a840043df4eb9db579b6c5efe0c8d11e8024f5af2ee8fda6bce2c10011b68d911aa71523d990d3500ece4957ccdcf5bddcb638abf284c2aeb
|
7
|
+
data.tar.gz: fc167d095da7e2979fc051b1d372b951ce3f76da311e87841d56f5e7f9a1db713a2b6aa81050293feb1d6a3b60e10898d60ba2882adf07ca91b68214fca11d5a
|
data/README.md
CHANGED
@@ -249,7 +249,7 @@ There are three special modifiers:
|
|
249
249
|
|
250
250
|
* `:nil` (symbol) to omit output when the attribute is set to nil
|
251
251
|
* `:empty` to omit output when the value is an empty string, an empty array or an empty hash
|
252
|
-
* `:always` to never output this
|
252
|
+
* `:always` to never output this attribute.
|
253
253
|
|
254
254
|
These can be mixed with real values, e.g.
|
255
255
|
|
data/lib/faker_maker.rb
CHANGED
@@ -35,12 +35,12 @@ module FakerMaker
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def []( name )
|
38
|
-
find_factory
|
38
|
+
factory = find_factory(name)
|
39
|
+
raise NoSuchFactoryError, "No such factory '#{name}'" unless factory
|
40
|
+
factory
|
39
41
|
end
|
40
42
|
|
41
43
|
def find_factory( name )
|
42
|
-
raise NoSuchFactoryError, "No such factory '#{name}'" if factories[name].nil?
|
43
|
-
|
44
44
|
factories[name]
|
45
45
|
end
|
46
46
|
end
|
data/lib/faker_maker/base.rb
CHANGED
@@ -4,10 +4,15 @@ module FakerMaker
|
|
4
4
|
# Base module for defining the DSL
|
5
5
|
module Base
|
6
6
|
def factory(name, options = {}, &block)
|
7
|
-
factory = FakerMaker
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
factory = FakerMaker.find_factory(name)
|
8
|
+
if factory.nil?
|
9
|
+
factory = FakerMaker::Factory.new name, options
|
10
|
+
proxy = DefinitionProxy.new factory
|
11
|
+
proxy.instance_eval( &block ) if block_given?
|
12
|
+
FakerMaker.register_factory factory
|
13
|
+
else
|
14
|
+
factory
|
15
|
+
end
|
11
16
|
end
|
12
17
|
|
13
18
|
end
|
data/lib/faker_maker/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faker_maker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nigel Brookes-Thomas
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|