hash-as-tree 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/hash/as/tree.rb +4 -2
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 48181687858a679f1ca8ac394e8df9b85d73a8e4
4
- data.tar.gz: 2462500e3cebc6a79e3b858ec546ca7fb87a6197
3
+ metadata.gz: 4f126d5a681da5ff54e1d477d8b855b14854d860
4
+ data.tar.gz: 8997d3f758b9f09c48d5b07a77b23fb2a817617a
5
5
  SHA512:
6
- metadata.gz: e662810002cf4c3eaf8a47c048d681ba0b01a8794a9454679f78e4975c41d6b91421042897159b707ccf0239c00a9dc20d70c29b7b3ca8f4583406cc328b9e95
7
- data.tar.gz: ece390faebd260ff64aafdad24f414397b17f7e51e7290fe260b730c65d09f5341fb17a3ed09cba94d8d5a529525242f3ee44977c33f8ee09872ab2500a9d693
6
+ metadata.gz: 12752602b8e3cf7ee1d193face699514b2d12863c503075ba210eaa4d4fed7575409313c8eb4591878471f9048275f3411101d139cfb368994ed7c5fc9e00b38
7
+ data.tar.gz: 9f6b21510a8a49793ea56b22508de39373e84f7848d2731a1d23d3a5eb30a8160a8d06080d1886d8244b814d9fb37d1782d8a1e749ea392e66f437e5a5643be8
data/lib/hash/as/tree.rb CHANGED
@@ -28,8 +28,10 @@ class Hash
28
28
  if passed_node == returned_node
29
29
  passed_node.children.each &[nodes, :push]
30
30
  else
31
- passed_node.parent.value.delete passed_node.key
32
- passed_node.parent.value[returned_node.key] = returned_node.value
31
+ if parent = passed_node.parent
32
+ parent.value.delete passed_node.key
33
+ parent.value[returned_node.key] = returned_node.value
34
+ end
33
35
  returned_node.children.each &[nodes, :push]
34
36
  end
35
37
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hash-as-tree
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anatoly Chernow
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-15 00:00:00.000000000 Z
11
+ date: 2017-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: to_proc