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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/userializer/array_serializer.rb +5 -2
- data/lib/userializer/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 176f64904bdd2aebe075ad93bb12ff1f900bdf5624b2a8a1c86001d7e9de497d
|
4
|
+
data.tar.gz: e7ca4ff8d4436e8880772f4e8c526137669b9993fdce4e87f23674d92ab071fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51e1b63bcd632e558169f670fef2c83a5360fc8c0cce079504088b0574c972050f523ffcc93b5f6fd3ce970e0bb7c20d9d9873a47ad7587051012b7b96853052
|
7
|
+
data.tar.gz: b9d61df410bf4d35d7f91d66fa439999c424164acf159990ca8105ed9795889e5619f3fa22b6cde3d8018a846dd9cd917caf6131334c257dd3027c3c0dd61873
|
data/Gemfile.lock
CHANGED
@@ -14,9 +14,10 @@ module USerializer
|
|
14
14
|
|
15
15
|
raise HeterogeneousArray if clss.count > 1
|
16
16
|
|
17
|
-
@root_key = opts[:root]
|
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
|
|
data/lib/userializer/version.rb
CHANGED