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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8dad7967bc0e3c689498afafca60a7b9c691aa8af466880ac5af87d5668e4706
4
- data.tar.gz: c7659747e882e4a9361507759629f4482068475c859dc9883a79ffdb62b916fb
3
+ metadata.gz: 1e4ab9d0a34167a7b16e6ee777d338f63398adcd44799975f0e48b4b62eae6a8
4
+ data.tar.gz: 67806c647397291ff25dcaf7a216bfde0ac9b9fec4d461907d84c0215cef297c
5
5
  SHA512:
6
- metadata.gz: fb83e7d087b54877d133d89b7b00f4c849eb8355c5dc9233b53dfe69d8a9096ec8f2da6edc5539a2334ab7afc880e1c5fb6369b590e69b31e8a7a99fb94b39f2
7
- data.tar.gz: 1e661f28f49569d73dbeeb8ddbd27226a5d124522d6fd07b53be9341f7021f7dc46595d9d1f55303f62df92a1d49b7276c68e854fee6f84e03b1866aa6197c79
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 attibute.
252
+ * `:always` to never output this attribute.
253
253
 
254
254
  These can be mixed with real values, e.g.
255
255
 
@@ -35,12 +35,12 @@ module FakerMaker
35
35
  end
36
36
 
37
37
  def []( name )
38
- find_factory name
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
@@ -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::Factory.new name, options
8
- proxy = DefinitionProxy.new factory
9
- proxy.instance_eval( &block ) if block_given?
10
- FakerMaker.register_factory factory
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FakerMaker
4
- VERSION = '1.1.3'
4
+ VERSION = '1.1.4'
5
5
  end
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.3
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-08-29 00:00:00.000000000 Z
11
+ date: 2019-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport