fmcache 0.3.0 → 0.4.0
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/fmcache/decoder/value_decoder/data.rb +5 -1
- data/lib/fmcache/encoder/itemizer.rb +5 -4
- data/lib/fmcache/encoder.rb +3 -4
- data/lib/fmcache/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b79c05d630df6693c5e414e4c715beed1ec241e3731d71fa9e4bf93a4406e6e6
|
4
|
+
data.tar.gz: 074a40df96e911ac2a5150325075336daec5600e64ba53cd8956e0aa92a7d3c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2319028a0e9cb0813e2a3e4bda3c28afb06a8e5305938ff3abb74fdd6885a2080b6025b90452525cbd34c641c191520ccea4f5b7cea9419cc83c2c5954f5054c
|
7
|
+
data.tar.gz: bac1356af719d330b90258d12429b4c32b3133d7e06176a5e7219532d4ff1cf8b5c463d9ccf318db5b24b301c29c80cf20a80be67af54ea9546964aa800650ff
|
data/Gemfile.lock
CHANGED
@@ -53,7 +53,11 @@ module FMCache
|
|
53
53
|
r[name] = item.value
|
54
54
|
end
|
55
55
|
@has_ones.each do |name, data|
|
56
|
-
|
56
|
+
if data
|
57
|
+
r[name] = data.to_h
|
58
|
+
else
|
59
|
+
r[name] = nil
|
60
|
+
end
|
57
61
|
end
|
58
62
|
@has_manies.each do |name, data_list|
|
59
63
|
r[name] = data_list.map(&:to_h)
|
@@ -29,10 +29,11 @@ module FMCache
|
|
29
29
|
end
|
30
30
|
|
31
31
|
field_mask.has_ones.each do |assoc|
|
32
|
-
v = value[assoc.name]
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
v = value[assoc.name]
|
33
|
+
if v # NOTE: Proceed only when value exists
|
34
|
+
p = prefix + [assoc.name]
|
35
|
+
traverse!(value: v, field_mask: assoc, prefix: p, p_id: id)
|
36
|
+
end
|
36
37
|
end
|
37
38
|
|
38
39
|
field_mask.has_manies.each do |assoc|
|
data/lib/fmcache/encoder.rb
CHANGED
@@ -10,10 +10,9 @@ module FMCache
|
|
10
10
|
|
11
11
|
r = {}
|
12
12
|
values.each do |value|
|
13
|
-
|
14
|
-
fields.
|
15
|
-
|
16
|
-
end
|
13
|
+
# NOTE: `[]` is the default value of each field.
|
14
|
+
h = fields.map { |f| [f, []] }.to_h
|
15
|
+
|
17
16
|
h.merge! encode_one(value, field_mask)
|
18
17
|
|
19
18
|
id = value.fetch(:id)
|
data/lib/fmcache/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fmcache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nao Minami
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|