light-services 2.0.0.rc3 → 2.0.0.rc4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/light/services/messages.rb +6 -4
- data/lib/light/services/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: 0cb56d628d4f4fa27faee797fb1292542a4804441b51bbad04063629ad85bf1a
|
4
|
+
data.tar.gz: 30ceeeed2d98b8e78d7d1ebe8d3aaee614d6f320a7038931eae2bcceb5518a69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0987294172814178aeec11f380433a361e1e469806958e1c6e12dc7465b9a166af58506531ee99c8d39ec78a45a57968fbd67973b10c45ee792ac7796ca0a4bc'
|
7
|
+
data.tar.gz: 63b6d21e02e68e93487f177a0096b341f55398b05a2876100e2c729eee10c33b75284e1f5a433038e9e431c60bf4296c5c477544b19938994b575e0dff4aa8b4
|
data/Gemfile.lock
CHANGED
@@ -10,13 +10,13 @@ module Light
|
|
10
10
|
@messages = {}
|
11
11
|
end
|
12
12
|
|
13
|
-
def add(key, message, opts = {})
|
13
|
+
def add(key, message, opts = {}, last: nil)
|
14
14
|
@messages[key] ||= []
|
15
15
|
@messages[key] += [*message]
|
16
16
|
|
17
17
|
raise!(key, message)
|
18
18
|
break!(opts[:break])
|
19
|
-
rollback!(opts[:rollback])
|
19
|
+
rollback!(opts[:rollback]) if last.nil? || last
|
20
20
|
end
|
21
21
|
|
22
22
|
def break?
|
@@ -27,8 +27,10 @@ module Light
|
|
27
27
|
if defined?(ActiveRecord::Base) && entity.is_a?(ActiveRecord::Base)
|
28
28
|
copy_from(entity.errors.messages, opts)
|
29
29
|
elsif entity.respond_to?(:each)
|
30
|
-
entity.
|
31
|
-
|
30
|
+
last_index = entity.size - 1
|
31
|
+
|
32
|
+
entity.each_with_index do |(key, message), index|
|
33
|
+
add(key, message, opts, last: index == last_index)
|
32
34
|
end
|
33
35
|
else
|
34
36
|
# TODO: Update error
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: light-services
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.rc4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Emelianenko
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Powerful implementation of Service Object pattern for Ruby and Rails
|
14
14
|
email:
|