error_normalizer 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/Gemfile.lock +2 -2
- data/lib/error_normalizer/normalizer.rb +5 -4
- data/lib/error_normalizer/schema_path_translator.rb +2 -2
- data/lib/error_normalizer/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: a6a89827f4de579d063163a35e830eed4c4f1cf3d491cb30053b3392b75224cb
|
4
|
+
data.tar.gz: ea6b31b86c5542db161e9297ba1f2ed8d3e4e9732c27bf096603cb9ef7d38d47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b3747acc7be3524f9c76e2699704378572a6300893e58dd72e473f7b0feecc3d4129384059471518e7586967d76877e1dec7d9a6f3e59da3b8315d6236a67eb
|
7
|
+
data.tar.gz: 595c13c118e91f7e5f62e96614b2a11b24a65950f973fd290141680556a68be3b1083abc61c422a5cd6f04af8d503080bcf4539c1adc32d8e934819c495a9728
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -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
|
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)
|
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)
|
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.
|
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:
|
11
|
+
date: 2019-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-configurable
|