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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb81dbbff7d706fe602201135936435e9bef0272da3e7b9544803b044c9d1229
4
- data.tar.gz: 55650dfc29a15a3e4782bf670accfe415fbcb67e590ed8d6cfdb3269ec73aa37
3
+ metadata.gz: a3198639643c0b5f2580775f5ce64ccd4da834b0d4b1b06ace981a94c1eab325
4
+ data.tar.gz: f87b229f92734a7e7f4b02646df7d162be92c7a426ca2abb53273878fb9d0875
5
5
  SHA512:
6
- metadata.gz: 15ed1028cd9f0cc9ef11927a019338234964b1a111d79361f1a7f059eed0431cefb2729378efb6e33101515491f43f423a393870f50c63c76f11dd48d86c945e
7
- data.tar.gz: 36d724d687476eaf7f579aadab4991895cc0bec741744456f1a1f319c4fa997ec7d55d7616d7bdeea812ac359fd2e899b7326cde6db130825451744e0b77d427
6
+ metadata.gz: d56e18f443575c02c8d112db9b9ac2d150a34bdab8174e7dd9fe66c80e3373068b9be9b84895123f8445eb81d1c93ae0ab004e37043b50bed8f83485b94cd77e
7
+ data.tar.gz: 25b04c4068c9d3ace57ed16ad555b44a89e6b1c093cc7eb0dc015a4d3477146a32e00e12b2a792de2a124de7bf48f5d319311eb457db459801d4ac0c9ecb44c6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- light_serializer (0.0.3)
4
+ light_serializer (0.0.4)
5
5
  oj (~> 3)
6
6
 
7
7
  GEM
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LightSerializer
4
- VERSION = '0.0.3'
4
+ VERSION = '0.0.4'
5
5
  end
@@ -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 = ['krim']
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.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
- - krim
7
+ - Pavel Rodionov
8
+ - Alexander Kotov
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2018-11-04 00:00:00.000000000 Z
12
+ date: 2018-11-06 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: oj