Module: NRSER::Ext::Tree

Included in:
Array, Hamster::Hash, Hamster::Vector, Hash
Defined in:
lib/nrser/ext/tree.rb

Overview

Instance methods that are refined in to the Ruby built-ins that we consider trees: Array, Hash and OpenStruct.

Instance Method Summary collapse

Instance Method Details

#each_branch(&block) ⇒ Object

Sends self and the optional block to NRSER.each_branch.



41
42
43
# File 'lib/nrser/ext/tree.rb', line 41

def each_branch &block
  NRSER.each_branch self, &block
end

#leavesObject

Sends self to NRSER.leaves.



27
28
29
# File 'lib/nrser/ext/tree.rb', line 27

def leaves
  NRSER.leaves self
end

#map_branches(&block) ⇒ Object

Calls NRSER.map_branches on self with &block.



48
49
50
# File 'lib/nrser/ext/tree.rb', line 48

def map_branches &block
  NRSER.map_branches self, &block
end

#map_leaves(&block) ⇒ Object

Calls NRSER.map_leaves on self with &block.



34
35
36
# File 'lib/nrser/ext/tree.rb', line 34

def map_leaves &block
  NRSER.map_leaves self, &block
end

#map_tree(**options, &block) ⇒ Object

Calls NRSER.map_tree on self with &block.



55
56
57
# File 'lib/nrser/ext/tree.rb', line 55

def map_tree **options, &block
  NRSER.map_tree self, **options, &block
end