zyra 1.0.0 → 1.1.0
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/zyra/creator.rb +6 -6
- data/lib/zyra/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62a10b511a268b79401186b32fb0c25fe60cfbe062770f8d6de2d97a6dfee4ea
|
4
|
+
data.tar.gz: 9f5a45fc0216b1e65a7d2f5482a05087ef78787accf8c5e940bf26794e5ca7bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c63b3d56aec07eacdc683fb8c8084ddb1a5f8c45011bcd8f85ce43a08df85c7d412482256075539038b266d7678dfe36a019dd36267402b8bc625ec4c821a71
|
7
|
+
data.tar.gz: bc6e5d3e3a3d3695716b048c40ea29bfeb43e62f3ffd192fb94f5887526acba84b28dcabaed422d1dd9c9e8caaa9a4b5d51528ac0504a5146b1cb79b8816c548
|
data/README.md
CHANGED
@@ -17,7 +17,7 @@ a creation in case of missing the entry
|
|
17
17
|
|
18
18
|
Yard Documentation
|
19
19
|
-------------------
|
20
|
-
[https://www.rubydoc.info/gems/zyra/1.
|
20
|
+
[https://www.rubydoc.info/gems/zyra/1.1.0](https://www.rubydoc.info/gems/zyra/1.1.0)
|
21
21
|
|
22
22
|
Installation
|
23
23
|
---------------
|
data/lib/zyra/creator.rb
CHANGED
@@ -24,10 +24,12 @@ module Zyra
|
|
24
24
|
#
|
25
25
|
# @return [Object] an instance of model class
|
26
26
|
def create(**attributes, &block)
|
27
|
-
|
27
|
+
block ||= proc {}
|
28
|
+
|
29
|
+
model = build(**attributes)
|
28
30
|
|
29
31
|
event_registry.trigger(:create, model) do
|
30
|
-
model.tap(&:save)
|
32
|
+
model.tap(&:save).tap(&block)
|
31
33
|
end
|
32
34
|
end
|
33
35
|
|
@@ -39,10 +41,8 @@ module Zyra
|
|
39
41
|
# @param (see #create)
|
40
42
|
# @yield (see #create)
|
41
43
|
# @return (see #create)
|
42
|
-
def build(**attributes
|
43
|
-
|
44
|
-
|
45
|
-
model_class.new(attributes).tap(&block).tap do |model|
|
44
|
+
def build(**attributes)
|
45
|
+
model_class.new(attributes).tap do |model|
|
46
46
|
event_registry.trigger(:build, model)
|
47
47
|
end
|
48
48
|
end
|
data/lib/zyra/version.rb
CHANGED