error_normalizer 0.2.2 → 0.2.3

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: 80dcea529cfae1e59e2790f38a949d975ba081b025ded1da80e53660659412e5
4
- data.tar.gz: 7a7e37dd94688cac4c2939e6106adfe42d87dfb7843d0e68c7da66a0228bc1b6
3
+ metadata.gz: a6a89827f4de579d063163a35e830eed4c4f1cf3d491cb30053b3392b75224cb
4
+ data.tar.gz: ea6b31b86c5542db161e9297ba1f2ed8d3e4e9732c27bf096603cb9ef7d38d47
5
5
  SHA512:
6
- metadata.gz: b71d60379c14f40bc054c5ab5f8b39abba0a114024913511100c55ebc2ffe16aab3c3a98761e2ee7a3dfcd07418ec80aaad6435d1573559a483aea75436bb307
7
- data.tar.gz: b589e8fd26dd63766e113ab8029eeebb3d2bdd0989ca292e20a0069b78882516ae0fde2385ba416b0da4144223b4956cdb35f80c2eb9307620a6cbb5cc8bf738
6
+ metadata.gz: 3b3747acc7be3524f9c76e2699704378572a6300893e58dd72e473f7b0feecc3d4129384059471518e7586967d76877e1dec7d9a6f3e59da3b8315d6236a67eb
7
+ data.tar.gz: 595c13c118e91f7e5f62e96614b2a11b24a65950f973fd290141680556a68be3b1083abc61c422a5cd6f04af8d503080bcf4539c1adc32d8e934819c495a9728
data/.rubocop.yml CHANGED
@@ -5,6 +5,9 @@ AllCops:
5
5
 
6
6
  #################### Style ###########################
7
7
 
8
+ Style/CaseEquality:
9
+ Enabled: false
10
+
8
11
  Style/Documentation:
9
12
  Enabled: true
10
13
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- error_normalizer (0.2.1)
4
+ error_normalizer (0.2.2)
5
5
  dry-configurable (~> 0.7.0)
6
6
 
7
7
  GEM
@@ -93,4 +93,4 @@ DEPENDENCIES
93
93
  rubocop (= 0.59.2)
94
94
 
95
95
  BUNDLED WITH
96
- 1.17.1
96
+ 1.17.3
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'i18n'
3
4
  require_relative 'error'
4
5
  require_relative 'message_parser'
5
6
 
@@ -45,7 +46,9 @@ class ErrorNormalizer
45
46
  # Primary method to normalize the given input
46
47
  # @return [self]
47
48
  def normalize
48
- if @input.is_a?(Hash)
49
+ if Error === @input
50
+ add_error(@input.dup)
51
+ elsif @input.is_a?(Hash)
49
52
  normalize_hash(@input.dup)
50
53
  elsif @input.respond_to?(:to_hash)
51
54
  normalize_hash(@input.to_hash)
@@ -64,9 +67,7 @@ class ErrorNormalizer
64
67
  private
65
68
 
66
69
  # TODO: support arrays of errors as input
67
- def normalize_hash(input) # rubocop:disable AbcSize
68
- return add_error(input) if input.is_a?(Error)
69
-
70
+ def normalize_hash(input)
70
71
  input.each do |key, value|
71
72
  if messages_ary?(value)
72
73
  options = prepare_error_options(key)
@@ -28,9 +28,9 @@ class ErrorNormalizer
28
28
  # schemas.user.account.status.@
29
29
  # schemas.user.account.status
30
30
  # schemas.status.@
31
- # schemas.tatus
31
+ # schemas.status
32
32
  # status.@
33
- # tatus
33
+ # status
34
34
  #
35
35
  # @return [String] translated path
36
36
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class ErrorNormalizer
4
- VERSION = '0.2.2'
4
+ VERSION = '0.2.3'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: error_normalizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Kondratenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-20 00:00:00.000000000 Z
11
+ date: 2019-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-configurable