pokotarou 1.1.0 → 1.1.1
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 +4 -4
- data/lib/pokotarou/data_structure.rb +13 -7
- data/lib/pokotarou/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: '09fe06e78e1bb9689b0bbdd003ad3261dee699ce3f201bdf9174b10b6771f629'
|
|
4
|
+
data.tar.gz: 14ae8d05a09c850be66328e46172f16aa2bce32dbacc2564802fa41982473c59
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e0a6dccec5227439517f6b52ec1da3ca6181bdf4b04e2bee2f6afb4b439d709899fe731332d11ddce677fac9c8a2ed112ec0ac95a9ef1bc2aa5da674e4f4aae0
|
|
7
|
+
data.tar.gz: f50b5e74b3c0aef027785cec760372ea2ab6df81323950180726d4ebbbaa196b6b2a788eb4e7a5fa2ac3b0e9a94a9f99e3aaac4ee27ae20ac0d7e56f4571cf51
|
|
@@ -31,18 +31,24 @@ class DataStructure
|
|
|
31
31
|
next unless has_template?(val)
|
|
32
32
|
template_name = val[:template]
|
|
33
33
|
template = templates[template_name.to_sym]
|
|
34
|
-
|
|
34
|
+
copy_template = template.deep_dup
|
|
35
|
+
# when a new key is generated, it is added behind
|
|
36
|
+
# so, overwrite config_data to template first
|
|
37
|
+
|
|
38
|
+
# from val to copy_template
|
|
39
|
+
deep_overwrite(val, copy_template)
|
|
40
|
+
# update config data
|
|
41
|
+
model_data[key] = copy_template
|
|
35
42
|
end
|
|
36
43
|
end
|
|
37
44
|
|
|
38
|
-
def
|
|
39
|
-
|
|
45
|
+
def deep_overwrite from_hash, to_hash
|
|
46
|
+
from_hash.each do |key, val|
|
|
40
47
|
if val.kind_of?(Hash)
|
|
41
|
-
|
|
42
|
-
|
|
48
|
+
to_hash[key] ||= Hash.new
|
|
49
|
+
deep_overwrite(val, to_hash[key])
|
|
43
50
|
else
|
|
44
|
-
|
|
45
|
-
config_data[key] ||= val
|
|
51
|
+
to_hash[key] = val
|
|
46
52
|
end
|
|
47
53
|
end
|
|
48
54
|
end
|
data/lib/pokotarou/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pokotarou
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kashiwara
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-10-
|
|
11
|
+
date: 2019-10-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|