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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 38e4a0f496e63ba78279cf3f1f1b671e838eb1509f4c59f4ee9694c831d64c13
4
- data.tar.gz: 8019b013bcef53aa1e9be21818dcb0ab21095d4f1db539b6c891967dc22afabd
3
+ metadata.gz: 0cb56d628d4f4fa27faee797fb1292542a4804441b51bbad04063629ad85bf1a
4
+ data.tar.gz: 30ceeeed2d98b8e78d7d1ebe8d3aaee614d6f320a7038931eae2bcceb5518a69
5
5
  SHA512:
6
- metadata.gz: b7f9f99835b0151b1f98016ad4af7767b17e49c3d65a1e991fe8522055a17f58301c183706bc30e2cebc40bd94990d21da70f66f01b17e104b2ed08c56a8a27e
7
- data.tar.gz: e2d2b02ca50631518a02329d4b439f253e59ce648cdb4e37448b7a43209a6d2379272c083516862e0dbe38e8999e6419f2d9ece538f0d8a4a15e73e292211dba
6
+ metadata.gz: '0987294172814178aeec11f380433a361e1e469806958e1c6e12dc7465b9a166af58506531ee99c8d39ec78a45a57968fbd67973b10c45ee792ac7796ca0a4bc'
7
+ data.tar.gz: 63b6d21e02e68e93487f177a0096b341f55398b05a2876100e2c729eee10c33b75284e1f5a433038e9e431c60bf4296c5c477544b19938994b575e0dff4aa8b4
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- light-services (2.0.0.rc2)
4
+ light-services (2.0.0.rc3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -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.each do |key, message|
31
- add(key, message, opts)
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Light
4
4
  module Services
5
- VERSION = "2.0.0.rc3"
5
+ VERSION = "2.0.0.rc4"
6
6
  end
7
7
  end
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.rc3
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-07-25 00:00:00.000000000 Z
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: