light_serializer 0.0.3 → 0.0.4
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/light_serializer/hashed_object.rb +1 -1
- data/lib/light_serializer/serializer.rb +3 -2
- data/lib/light_serializer/version.rb +1 -1
- data/light_serializer.gemspec +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3198639643c0b5f2580775f5ce64ccd4da834b0d4b1b06ace981a94c1eab325
|
4
|
+
data.tar.gz: f87b229f92734a7e7f4b02646df7d162be92c7a426ca2abb53273878fb9d0875
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d56e18f443575c02c8d112db9b9ac2d150a34bdab8174e7dd9fe66c80e3373068b9be9b84895123f8445eb81d1c93ae0ab004e37043b50bed8f83485b94cd77e
|
7
|
+
data.tar.gz: 25b04c4068c9d3ace57ed16ad555b44a89e6b1c093cc7eb0dc015a4d3477146a32e00e12b2a792de2a124de7bf48f5d319311eb457db459801d4ac0c9ecb44c6
|
data/Gemfile.lock
CHANGED
@@ -51,7 +51,7 @@ module LightSerializer
|
|
51
51
|
attribute_name = attribute.keys.last
|
52
52
|
nested_serializer = attribute.values.last
|
53
53
|
value = obtain_value(object, attribute_name)
|
54
|
-
result[attribute_name] = nested_serializer.new(value).to_hash
|
54
|
+
result[attribute_name] = nested_serializer.new(value, context: serializer.context).to_hash
|
55
55
|
end
|
56
56
|
|
57
57
|
def values_from_current_resource(attribute, object, result)
|
@@ -5,7 +5,7 @@ require 'light_serializer/hashed_object'
|
|
5
5
|
|
6
6
|
module LightSerializer
|
7
7
|
class Serializer
|
8
|
-
attr_reader :object, :root
|
8
|
+
attr_reader :object, :root, :context
|
9
9
|
|
10
10
|
def self.attributes(*new_attributes)
|
11
11
|
return @attributes if new_attributes.empty?
|
@@ -18,9 +18,10 @@ module LightSerializer
|
|
18
18
|
super(subclass)
|
19
19
|
end
|
20
20
|
|
21
|
-
def initialize(object, root: nil)
|
21
|
+
def initialize(object, root: nil, context: nil)
|
22
22
|
@object = object
|
23
23
|
@root = root
|
24
|
+
@context = context
|
24
25
|
end
|
25
26
|
|
26
27
|
def to_json
|
data/light_serializer.gemspec
CHANGED
@@ -8,7 +8,7 @@ require 'light_serializer/version'
|
|
8
8
|
Gem::Specification.new do |spec|
|
9
9
|
spec.name = 'light_serializer'
|
10
10
|
spec.version = LightSerializer::VERSION
|
11
|
-
spec.authors = ['
|
11
|
+
spec.authors = ['Pavel Rodionov', 'Alexander Kotov']
|
12
12
|
spec.email = ['pasha.rod@mail.ru']
|
13
13
|
|
14
14
|
spec.summary = 'Light and Fast Serializer'
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: light_serializer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Pavel Rodionov
|
8
|
+
- Alexander Kotov
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
12
|
+
date: 2018-11-06 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: oj
|