adequate_serialization 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a78d88a2501cf72c9d7b2752de13d260fbe6e2b3aae542dded2e7f7a8f61f037
|
4
|
+
data.tar.gz: 5242b799a239f6224461bc00ffdd60f2d182edf9f28e405228321bf382871672
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5d4071ea9064f3f54ae6f375f767d61f7417e4da907422526cfa83a7e6af572ae4b2963277f2dfb497a57e408343c6f4c0a0a265c0cfa6064dfd318beecba68
|
7
|
+
data.tar.gz: c16e33d20c2b7000d3a0601b9f1fd353b1149314ce2f238d74e3515482b0330a12ac89aaa0e983bb0c08ba975e00ecf1409d3a81f099a94518ea8be78c243434
|
data/Gemfile.lock
CHANGED
@@ -9,7 +9,7 @@ module AdequateSerialization
|
|
9
9
|
@name = name
|
10
10
|
end
|
11
11
|
|
12
|
-
def serialize_to(response, model, _includes)
|
12
|
+
def serialize_to(_serializer, response, model, _includes)
|
13
13
|
response[name] = AdequateSerialization.dump(model.public_send(name))
|
14
14
|
end
|
15
15
|
end
|
@@ -22,8 +22,9 @@ module AdequateSerialization
|
|
22
22
|
@block = block
|
23
23
|
end
|
24
24
|
|
25
|
-
def serialize_to(response, model, _includes)
|
26
|
-
response[name] =
|
25
|
+
def serialize_to(serializer, response, model, _includes)
|
26
|
+
response[name] =
|
27
|
+
AdequateSerialization.dump(serializer.instance_exec(model, &block))
|
27
28
|
end
|
28
29
|
end
|
29
30
|
|
@@ -35,9 +36,9 @@ module AdequateSerialization
|
|
35
36
|
@condition = condition
|
36
37
|
end
|
37
38
|
|
38
|
-
def serialize_to(response, model, includes)
|
39
|
+
def serialize_to(serializer, response, model, includes)
|
39
40
|
return unless model.public_send(condition)
|
40
|
-
attribute.serialize_to(response, model, includes)
|
41
|
+
attribute.serialize_to(serializer, response, model, includes)
|
41
42
|
end
|
42
43
|
end
|
43
44
|
|
@@ -49,9 +50,9 @@ module AdequateSerialization
|
|
49
50
|
@condition = condition
|
50
51
|
end
|
51
52
|
|
52
|
-
def serialize_to(response, model, includes)
|
53
|
+
def serialize_to(serializer, response, model, includes)
|
53
54
|
return if model.public_send(condition)
|
54
|
-
attribute.serialize_to(response, model, includes)
|
55
|
+
attribute.serialize_to(serializer, response, model, includes)
|
55
56
|
end
|
56
57
|
end
|
57
58
|
|
@@ -62,9 +63,9 @@ module AdequateSerialization
|
|
62
63
|
@attribute = attribute
|
63
64
|
end
|
64
65
|
|
65
|
-
def serialize_to(response, model, includes)
|
66
|
+
def serialize_to(serializer, response, model, includes)
|
66
67
|
return unless includes.include?(attribute.name)
|
67
|
-
attribute.serialize_to(response, model, includes)
|
68
|
+
attribute.serialize_to(serializer, response, model, includes)
|
68
69
|
end
|
69
70
|
end
|
70
71
|
|
@@ -24,7 +24,7 @@ module AdequateSerialization
|
|
24
24
|
|
25
25
|
def serialize(model, opts = Options.null)
|
26
26
|
self.class.attributes.each_with_object({}) do |attribute, response|
|
27
|
-
attribute.serialize_to(response, model, opts.includes)
|
27
|
+
attribute.serialize_to(self, response, model, opts.includes)
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adequate_serialization
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Deisz
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|