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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2e36d9755f7ed2c3f0a2e723405f6a633b1f3d5034c9ba1823441ab1cf0fb01d
4
- data.tar.gz: c7b5467264f7d06f79361b00277e752345ce14c0879fbceeb2752b5cd7b0eb6e
3
+ metadata.gz: '09fe06e78e1bb9689b0bbdd003ad3261dee699ce3f201bdf9174b10b6771f629'
4
+ data.tar.gz: 14ae8d05a09c850be66328e46172f16aa2bce32dbacc2564802fa41982473c59
5
5
  SHA512:
6
- metadata.gz: 1cf01f158f6f73f494009bdcb930e2c12d6ee47ed9c017ff2408c04ae744aa605e388ee2843fbee493cd5a0b0847d0d66b63fe53887279fd5d1b6c2618cbb4d4
7
- data.tar.gz: 69c4b0079556d2060d42c2c1a9f53e1fe7d65f95e107ce488c56dde6d278893b1d074f81883423e0b01300d2640db30abbd5bc9574b72fd6127d7258763fbcd5
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
- apply_template_option(val, template)
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 apply_template_option config_data, template
39
- template.each do |key, val|
45
+ def deep_overwrite from_hash, to_hash
46
+ from_hash.each do |key, val|
40
47
  if val.kind_of?(Hash)
41
- config_data[key] ||= Hash.new
42
- apply_template_option(config_data[key], val)
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
@@ -1,3 +1,3 @@
1
1
  module Pokotarou
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.1'
3
3
  end
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.0
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-20 00:00:00.000000000 Z
11
+ date: 2019-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails