hash-as-tree 0.0.1 → 0.0.2

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/hash/as/tree.rb +1 -1
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4f126d5a681da5ff54e1d477d8b855b14854d860
4
- data.tar.gz: 8997d3f758b9f09c48d5b07a77b23fb2a817617a
3
+ metadata.gz: 9f4a8aed3815ad6b18d6d5a305a9f01d42c283ca
4
+ data.tar.gz: c590329b2886a799d25d130749cb0f02cbed49fc
5
5
  SHA512:
6
- metadata.gz: 12752602b8e3cf7ee1d193face699514b2d12863c503075ba210eaa4d4fed7575409313c8eb4591878471f9048275f3411101d139cfb368994ed7c5fc9e00b38
7
- data.tar.gz: 9f6b21510a8a49793ea56b22508de39373e84f7848d2731a1d23d3a5eb30a8160a8d06080d1886d8244b814d9fb37d1782d8a1e749ea392e66f437e5a5643be8
6
+ metadata.gz: 6625a22f545a19ab3aa336dd9f9c727a34192a6597a7b6f799b1f7679bd60d4cb2ee8397c10103a1a1aae96fff7402ac9658de959ef8cc9f0c2beba13e2eecc7
7
+ data.tar.gz: 35b177b9c78d4796a17dcb52e5e52a0193c6082aa46affb385cc613158b1ab3f73f3982a9b5815a94a37ee83bff7e31c4e192314c6fbc853e67cb9c7a450b7b8
data/lib/hash/as/tree.rb CHANGED
@@ -48,7 +48,7 @@ class Hash
48
48
 
49
49
  def to_h
50
50
  if key
51
- if value.is_a? Hash
51
+ if value.is_a?(Hash) && (not value.empty?)
52
52
  { key => children.map(&:to_h).reduce(&:merge) }
53
53
  else
54
54
  { key => value }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hash-as-tree
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anatoly Chernow