fabricas 1.1.1 → 1.1.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 +4 -4
- data/README.md +1 -1
- data/lib/fabricas.rb +4 -5
- 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: b068777483a9ee32ee5cc084ee922943c6737ec7
|
4
|
+
data.tar.gz: 13fce60f2f6fd4e65a6f895f4c804070e1958f88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee8586fd90a442a9d07fb84e87e593418b8b2718493a87cf6e64314767ef938bc4064db1fb7b169e8a5899ec30c47c031b7b7e0d7cd0200df6f378a5f4d67828
|
7
|
+
data.tar.gz: ba8ca31c3907a3f21a8364c13aacd2e4eb89d733bac0b7c531a8d345c7b25eaeba9cb24a22bc224287b9f5cb2517015d781a65fffdd4d571a92bd1dc7e17ca91
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@ Minimalist library for build factories.
|
|
5
5
|
|
6
6
|
## Introduction
|
7
7
|
|
8
|
-
Fabricas is simple, just a few lines of code. Is framework agnostic,
|
8
|
+
Fabricas is simple, just a few lines of code. Is framework agnostic, with cero requires and monkey-patch helps you to build objects fast.
|
9
9
|
|
10
10
|
## Installation
|
11
11
|
|
data/lib/fabricas.rb
CHANGED
@@ -18,9 +18,8 @@
|
|
18
18
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
19
|
# SOFTWARE.
|
20
20
|
module Fabricas
|
21
|
-
VERSION = "1.1.
|
21
|
+
VERSION = "1.1.2"
|
22
22
|
@factories = {}
|
23
|
-
def self.factories; @factories; end
|
24
23
|
|
25
24
|
def self.define(&block)
|
26
25
|
module_eval(&block)
|
@@ -29,15 +28,15 @@ module Fabricas
|
|
29
28
|
def self.factory(klass, args = {}, &block)
|
30
29
|
_p = args.fetch(:parent, nil)
|
31
30
|
if block_given?
|
32
|
-
_f = factories[klass] = CleanRoom.new(args.fetch(:class_name, nil) || (_p.class_name if _p) || klass)
|
31
|
+
_f = @factories[klass] = CleanRoom.new(args.fetch(:class_name, nil) || (_p.class_name if _p) || klass)
|
33
32
|
_f.attributes = _p.attributes.clone if _p
|
34
33
|
_f.instance_eval(&block)
|
35
34
|
end
|
36
35
|
end
|
37
36
|
|
38
37
|
def self.build(klass, values = {})
|
39
|
-
_i = const_get(factories[klass].class_name.capitalize).new
|
40
|
-
attributes = factories[klass].attributes.merge(values)
|
38
|
+
_i = const_get(@factories[klass].class_name.capitalize).new
|
39
|
+
attributes = @factories[klass].attributes.merge(values)
|
41
40
|
attributes.each do |name, value|
|
42
41
|
_i.send("#{name}=", value.is_a?(Proc) ? _i.instance_eval(&value) : value)
|
43
42
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fabricas
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julio Lopez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cutest
|