ree_lib 1.0.10 → 1.0.11

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: 44e1a436822756b530e7f11947c68f43377096b4b15d8c6d60880a8f2116d1b2
4
- data.tar.gz: cea2b849ec06361e461b282c93632cbcc2131bedfcbf260c87fcca56dfb53539
3
+ metadata.gz: d1857f5c4388ddb54b06b96eec4dff68b48500010d6fe83c7745074c259e3ba6
4
+ data.tar.gz: 7b8c5bca28e57ee3da6fc6ccb1c032db43b9b1bfb516c23c7cb6be8aed0c2e5c
5
5
  SHA512:
6
- metadata.gz: 53f014bef46e41b7f1826ef4487ff0fce03c66b4578a7d6ddd65a37aaa94989aef52523dd368514f1e533b141aac9e9fedc341e4cc14b69dc4a1528482c53ed1
7
- data.tar.gz: fe75d4036275c8a4013fbb064ced2f61b014c7ccccb5e48b7966e83f22f44adbc47345b37c01c2498f6f1d1dc035a21bf3ffa6a86a9aca0ac85665d8a13ac74b
6
+ metadata.gz: cedd921b6f53e8d6510f8bf55d52a3414dda9440012277798aa5ff77429c01448520574377e28d36aa6784d6e6dec9509b5830670a6ef1d2c772e430db1dcead
7
+ data.tar.gz: c1df54e9603fbe776a4ce507bff3379e699592052735ed93caa9078232879b914957e611bdb5098efd1f5440488005cdcb60eaba8a8672559dd7e72f50104282
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ree_lib (1.0.10)
4
+ ree_lib (1.0.11)
5
5
  binding_of_caller (~> 1.0.0)
6
6
  i18n (~> 1.12.0)
7
7
  loofah (~> 2.18.0)
@@ -7,6 +7,8 @@ class ReeJson::FromJson
7
7
  }
8
8
  end
9
9
 
10
+ ParseJsonError = Class.new(StandardError)
11
+
10
12
  contract(
11
13
  Any,
12
14
  Kwargs[
@@ -16,7 +18,7 @@ class ReeJson::FromJson
16
18
  symbol_keys?: Bool,
17
19
  RestKeys => Any
18
20
  ] => Hash
19
- ).throws(ArgumentError)
21
+ ).throws(ParseJsonError)
20
22
  def call(object, mode: :rails, **opts)
21
23
  options = DEFAULT_OPTIONS
22
24
  .dup
@@ -25,5 +27,7 @@ class ReeJson::FromJson
25
27
  )
26
28
 
27
29
  Oj.load(object, options)
30
+ rescue ArgumentError, EncodingError
31
+ raise ParseJsonError.new
28
32
  end
29
33
  end
@@ -10,7 +10,7 @@
10
10
  {
11
11
  "doc": "",
12
12
  "throws": [
13
- "ArgumentError"
13
+ "ReeJson::FromJson::ParseJsonError"
14
14
  ],
15
15
  "return": "Hash",
16
16
  "args": [
@@ -11,4 +11,8 @@ RSpec.describe :from_json do
11
11
  result = from_json("{\":id\":{\"^o\":\"Object\"}}", mode: :object)
12
12
  expect(result[:id]).to be_a(Object)
13
13
  }
14
+
15
+ it {
16
+ expect{from_json("{213: \"123\"}")}.to raise_error(ReeJson::FromJson::ParseJsonError)
17
+ }
14
18
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ReeLib
4
- VERSION = "1.0.10"
4
+ VERSION = "1.0.11"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ree_lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.10
4
+ version: 1.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ruslan Gatiyatov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-08-16 00:00:00.000000000 Z
11
+ date: 2022-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ree