serega 0.1.3 → 0.1.4

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: a0677ac2e319673d37e712b840c9485abf9ec2cd578a66d0a4d667e6134b4b3e
4
- data.tar.gz: 7711764ae779bd31ed3c203fff925279ca19c9c74acb94cc58e4a4a302da35a9
3
+ metadata.gz: ad827e730d35f4e1805b7a0c59e8a8eeec87a91bb426ada370ea4a632516f40c
4
+ data.tar.gz: 681deb3a954453740ac3256614684601aeb18027423352ca05cc62c82ff37784
5
5
  SHA512:
6
- metadata.gz: e5f26401f3388020f8051543f19a03f223b424d55d9ce91a6c11c0ad7646e398d68d746227746297f5fb9dc387c7adaa84f6fdaa2d0829b8f2d3e13b516c28ec
7
- data.tar.gz: 0fbb40978adcaa91756bd59f6ed70b5a905eb25f0b6e60d2bb22f85bd4e9f7c4a51f37c987d035cc761bb0cab52f400472718ea992b576c89a39d582267c6b9a
6
+ metadata.gz: 6f279fecc4038a162b33d97001fa993758eb4d687c0a7b83f9555f20781e3ece12b1381ba9765993cf5a4d7a31a5dee66f29d3279e1198a6ddf6b6d19b977682
7
+ data.tar.gz: c1ed8f5f7e06ff2df08f2f5fb8ee587d062e3197399475c55d1383ab0fcb6c4c8f5224363ef202ecccdab063964a9e5cf98581ecdacfa5ac5caafa02277c93c6
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.1.4
@@ -14,8 +14,8 @@ class Serega
14
14
  end
15
15
 
16
16
  def self.load_plugin(serializer_class, **_opts)
17
- serializer_class.include(InstanceMethods)
18
17
  serializer_class::Convert.include(ConvertInstanceMethods)
18
+ serializer_class::CheckSerializeParams.extend(CheckSerializeParamsClassMethods)
19
19
  end
20
20
 
21
21
  def self.after_load_plugin(serializer_class, **opts)
@@ -25,16 +25,12 @@ class Serega
25
25
  config[:serialize_keys] << meta_key
26
26
  end
27
27
 
28
- module InstanceMethods
29
- def to_h(object, **opts)
30
- meta_key = self.class.config[:context_metadata][:key]
31
- meta = opts[meta_key]
32
-
33
- if meta && !meta.is_a?(Hash)
34
- raise Serega::Error, "Option :#{meta_key} must be a Hash, but #{meta.class} was given"
35
- end
36
-
28
+ module CheckSerializeParamsClassMethods
29
+ def check_opts(opts)
37
30
  super
31
+
32
+ meta_key = serializer_class.config[:context_metadata][:key]
33
+ Validations::Utils::CheckOptIsHash.call(opts, meta_key)
38
34
  end
39
35
  end
40
36
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serega
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey Glushkov