heavy_hash 0.0.2 → 0.0.3

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.
@@ -1,3 +1,3 @@
1
1
  module HeavyHash
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
data/lib/heavy_hash.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  require 'forwardable'
2
2
  require 'set'
3
- require 'json'
4
3
 
5
4
  class HeavyHash
6
5
  attr_reader :content, :hash
@@ -23,8 +22,9 @@ class HeavyHash
23
22
  @parent.delete(@key) if empty?
24
23
  end
25
24
 
26
- def leaves
27
- content + hash.values.map(&:leaves).flatten
25
+ def leaves(include_current_node=true)
26
+ child_leaves = hash.values.map(&:leaves).flatten
27
+ include_current_node ? content+child_leaves : child_leaves
28
28
  end
29
29
 
30
30
  def empty?
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 2
9
- version: 0.0.2
8
+ - 3
9
+ version: 0.0.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Niko Dittmann