dry-mutations 1.3.5 → 1.3.6

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
  SHA1:
3
- metadata.gz: 36a9e4700fb903a96a95bac23bd946e23a58f68e
4
- data.tar.gz: ca3c9bff64be85144c0ec336b21ea6cb61370609
3
+ metadata.gz: cf6bbd4522768259ef715c8355d1df37d7a1b462
4
+ data.tar.gz: 799202ecb31b42566979e4580fda145824b4e338
5
5
  SHA512:
6
- metadata.gz: ae28b427d056715832302f67299a9d2102d302de3369fc185651652d84497a94a002d4fef8b76e173a551056582ab4387d16b7364b53ac4bfa412fe18323f20d
7
- data.tar.gz: 55dd9027ccfd3d628b54dd1d299618a3cc3609d1fc874d2fac83e18d54666d7005851224b8cf040e60130f0899adab5c12e0b51fd27de930cc56f4e41a098900
6
+ metadata.gz: c7c4add8813f45de0fa29a66e81b880bc2c4d7718a631b4f49c50ddb355b9a99d5b57a45bf211d9312b92e0128ede6bd1b3018b4739361da44b6bb45cc581b4e
7
+ data.tar.gz: 82648f98e4ac959de064884cfc26e84cacf6491f67ff1a7d40f64cc401b9be0c8d2ed40bd8f4f41a08933121643dbddbe1eba0df80d3f3e4a537a532b4ced6eb
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dry-mutations (1.3.5)
4
+ dry-mutations (1.3.6)
5
5
  activesupport (>= 3.2, < 5)
6
6
  dry-transaction (~> 0.9, < 0.10)
7
7
  dry-validation (~> 0.10)
@@ -24,13 +24,14 @@ module Dry
24
24
  # key = msg.path.join('.')
25
25
  last = msg.path.pop
26
26
  tail = msg.path.inject(memo) { |acc, curr| acc[curr.to_s] ||= ::Mutations::ErrorHash.new }
27
- tail[last.to_s] = case tail[last.to_s]
28
- when ErrorAtom then ::Mutations::ErrorArray.new << tail[last.to_s]
29
- when NilClass then ::Mutations::ErrorArray.new
30
- when ::Mutations::ErrorArray then tail[last.to_s]
31
- end
32
-
33
- tail[last.to_s] << new(last, msg.predicate, msg, message: msg.text, index: idx)
27
+ tail[last] = case tail[last]
28
+ when ErrorAtom then ::Mutations::ErrorArray.new << tail[last.to_s]
29
+ when NilClass then ::Mutations::ErrorArray.new
30
+ when ::Mutations::ErrorArray then tail[last.to_s]
31
+ end
32
+ key = msg.respond_to?(:predicate) ? msg.predicate : last
33
+ text = msg.respond_to?(:text) ? msg.text : msg.to_s
34
+ tail[last.to_s] << new(last, key, msg, message: text, index: idx)
34
35
  # memo[key] = new(key, msg.predicate, msg, message: msg.text, index: idx)
35
36
  end
36
37
  end
@@ -1,13 +1,13 @@
1
1
  module Dry
2
2
  module Mutations
3
- class Form < ::Dry::Validation::Form
4
- @@discarded = []
3
+ class Form < ::Dry::Validation::Form # :nodoc:
4
+ @discarded = []
5
5
 
6
6
  configure(&::Dry::Validation::Schema::CONFIGURATOR)
7
7
  # predicates(::Dry::Mutations::Predicates)
8
8
 
9
9
  def discarded
10
- @@discarded
10
+ self.class.instance_variable_get :@discarded
11
11
  end
12
12
 
13
13
  def discarded?
@@ -17,7 +17,7 @@ module Dry
17
17
  require 'hashie/dash'
18
18
  require 'hashie/extensions/dash/indifferent_access'
19
19
  require 'hashie/extensions/indifferent_access'
20
- ::Mutations::ErrorHash.include Hashie::Extensions::IndifferentAccess
20
+ ::Mutations::ErrorHash.include Hashie::Extensions::Dash::IndifferentAccess
21
21
  true
22
22
  rescue LoadError => e
23
23
  $stderr.puts [
@@ -1,5 +1,5 @@
1
1
  module Dry
2
2
  module Mutations
3
- VERSION = '1.3.5'.freeze
3
+ VERSION = '1.3.6'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-mutations
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aleksei Matiushkin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-27 00:00:00.000000000 Z
11
+ date: 2017-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler