easy_serializer 0.3.1 → 0.3.2

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
- SHA1:
3
- metadata.gz: ebcff111f3619af4f2814b418809a7811b63b6d8
4
- data.tar.gz: aeae760e793004d0f50572ca4eb4bb98aa588dc0
2
+ SHA256:
3
+ metadata.gz: 51a5fce9d5fdf2ba86d18f1c54f43cb5a0094952c45ad4701e731bb17ebafabc
4
+ data.tar.gz: e71a8a20266a1e0d7fe1e0ff75acfea1fc63f77bb0d1bc671506f3143a3568e9
5
5
  SHA512:
6
- metadata.gz: 552783179ccb762ab515aeb4a98a52f138dca208fbdac9b6723f1d1d006d76ec19065a61f1947031121d3f0dc3cb5f6fc8a05fafaea090b279a619fc548c821a
7
- data.tar.gz: aa205fb92d1f7237ec6374c912c59537b6437b387a919a1bd9859fd9a0374c4ab6c2bb11a44b09ce93158ecc8fa914c654546b40e994a942d17d329cb8dc5afa
6
+ metadata.gz: 59865f058272e4ba91a1705ded10442461d01d4579223fe7aabb96dcb3e48d1d3c17610352bf011336d7aeda597b1d71266d2e1168929ab68caddfc9bfd5ccbc
7
+ data.tar.gz: b05b744a61f759f3928a5c2ffebe58f964df33a56a7e6afffb7169ec647b5ea7b4a14dd1f242e4de17f919503b9e7226cd5dde6073c600cae0078984f694703e
@@ -0,0 +1 @@
1
+ 2.5.1
@@ -8,6 +8,8 @@ rvm:
8
8
  - 2.1.6
9
9
  - 2.2
10
10
  - 2.3.0
11
+ - 2.4.0
12
+ - 2.5.1
11
13
  - ruby-head
12
14
  - jruby-19mode
13
15
  - jruby-9.0.1.0
@@ -14,9 +14,9 @@ module EasySerializer
14
14
 
15
15
  def key(elem)
16
16
  if metadata_key
17
- [elem, metadata_key, nested_serializer.name]
17
+ [cache_key(elem), metadata_key, nested_serializer.name]
18
18
  else
19
- [elem, nested_serializer.name]
19
+ [cache_key(elem), nested_serializer.name]
20
20
  end.flatten
21
21
  end
22
22
 
@@ -7,12 +7,16 @@ module EasySerializer
7
7
  end
8
8
 
9
9
  def key
10
- cache_key = if metadata.cache_key
11
- option_to_value(metadata.cache_key, serializer.object, serializer)
12
- else
13
- metadata.name
14
- end
15
- [serializer.object, cache_key, serializer.class.name].flatten
10
+ extra_cache_key = if metadata.cache_key
11
+ option_to_value(metadata.cache_key, serializer.object, serializer)
12
+ else
13
+ metadata.name
14
+ end
15
+ [cache_key, extra_cache_key, serializer.class.name].flatten
16
+ end
17
+
18
+ def subject
19
+ serializer.object
16
20
  end
17
21
 
18
22
  def options
@@ -8,12 +8,16 @@ module EasySerializer
8
8
 
9
9
  def key
10
10
  if metadata_key
11
- [value, metadata_key, nested_serializer.name]
11
+ [cache_key, metadata_key, nested_serializer.name]
12
12
  else
13
- [value, nested_serializer.name]
13
+ [cache_key, nested_serializer.name]
14
14
  end.flatten
15
15
  end
16
16
 
17
+ def subject
18
+ value
19
+ end
20
+
17
21
  def options
18
22
  metadata.cache_options || {}
19
23
  end
@@ -11,6 +11,10 @@ module EasySerializer
11
11
  received_opts.merge(collection: true)
12
12
  end
13
13
 
14
+ def send_method(obj)
15
+ obj.send(name).to_a
16
+ end
17
+
14
18
  def received_opts
15
19
  _options || {}
16
20
  end
@@ -13,5 +13,11 @@ module EasySerializer
13
13
  option
14
14
  end
15
15
  end
16
+
17
+ def cache_key(input_object = nil)
18
+ _object = input_object || subject
19
+ return _object.cache_key if _object.respond_to?(:cache_key)
20
+ _object
21
+ end
16
22
  end
17
23
  end
@@ -19,6 +19,12 @@ module EasySerializer
19
19
  def object
20
20
  serializer.object
21
21
  end
22
+ alias_method :subject, :object
23
+
24
+ def cache_key
25
+ return object.cache_key if object.respond_to?(:cache_key)
26
+ object
27
+ end
22
28
 
23
29
  def options
24
30
  h = serializer.__cache.dup
@@ -32,9 +38,9 @@ module EasySerializer
32
38
  custom_key = serializer.__cache[:key]
33
39
  if custom_key
34
40
  k = option_to_value(custom_key, object, serializer)
35
- [object, k, serializer.class.name]
41
+ [cache_key, k, serializer.class.name]
36
42
  else
37
- [object, serializer.class.name]
43
+ [cache_key, serializer.class.name]
38
44
  end.flatten
39
45
  end
40
46
 
@@ -1,3 +1,3 @@
1
1
  module EasySerializer
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy_serializer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artur Pañach
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-28 00:00:00.000000000 Z
11
+ date: 2019-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -65,6 +65,7 @@ files:
65
65
  - ".coveralls.yml"
66
66
  - ".gitignore"
67
67
  - ".rspec"
68
+ - ".ruby-version"
68
69
  - ".travis.yml"
69
70
  - CODE_OF_CONDUCT.md
70
71
  - Gemfile
@@ -109,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
110
  version: '0'
110
111
  requirements: []
111
112
  rubyforge_project:
112
- rubygems_version: 2.5.2.2
113
+ rubygems_version: 2.7.6
113
114
  signing_key:
114
115
  specification_version: 4
115
116
  summary: Semantic serializer for making easy serializing objects.