userializer 0.1.2 → 0.1.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: 005acb6633b44efdcba248bb884d037db223f4fcd214922d0b3f652fc4e31bea
4
- data.tar.gz: 11297dd72a7cc9db42e90dc47567b66cbaea86ae511507fadc59bdef91e2d3ee
3
+ metadata.gz: 176f64904bdd2aebe075ad93bb12ff1f900bdf5624b2a8a1c86001d7e9de497d
4
+ data.tar.gz: e7ca4ff8d4436e8880772f4e8c526137669b9993fdce4e87f23674d92ab071fd
5
5
  SHA512:
6
- metadata.gz: aed7569fce17d28d3f8d774487ce0743c4e5b11d4a90d41f077b52efe6013ced67e1eef9e8c4d10435a309a62a69beefdc1736571b1859b4af99a9783a2c1519
7
- data.tar.gz: ec13d1091403bce5a7d9b87a5f10e27e6f98494795117501fdf5155642c9f2ed802dc015ae4a5c46b5c125831572350d8ed923696b49b4dad9dadd37e08215d4
6
+ metadata.gz: 51e1b63bcd632e558169f670fef2c83a5360fc8c0cce079504088b0574c972050f523ffcc93b5f6fd3ce970e0bb7c20d9d9873a47ad7587051012b7b96853052
7
+ data.tar.gz: b9d61df410bf4d35d7f91d66fa439999c424164acf159990ca8105ed9795889e5619f3fa22b6cde3d8018a846dd9cd917caf6131334c257dd3027c3c0dd61873
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- userializer (0.1.2)
4
+ userializer (0.1.3)
5
5
  activesupport
6
6
  oj
7
7
 
@@ -14,9 +14,10 @@ module USerializer
14
14
 
15
15
  raise HeterogeneousArray if clss.count > 1
16
16
 
17
- @root_key = opts[:root] || ActiveSupport::Inflector.pluralize(
17
+ @root_key = opts[:root]
18
+ @root_key ||= ActiveSupport::Inflector.pluralize(
18
19
  ActiveSupport::Inflector.underscore(obj_class.name).split('/').last
19
- ).to_sym
20
+ ).to_sym if obj_class
20
21
 
21
22
  @serializer = opts[:each_serializer] || USerializer.infered_serializer_class(
22
23
  obj_class
@@ -32,6 +33,8 @@ module USerializer
32
33
  def to_hash
33
34
  res = {}
34
35
 
36
+ res[@root_key] = [] if @root_key
37
+
35
38
  merge_root(res, @opts)
36
39
  res[:meta] = @meta if @meta
37
40
 
@@ -1,3 +1,3 @@
1
1
  module USerializer
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: userializer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexis Montagne