Module: NRSER::Ext::Tree

Included in:
Array, 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.



24
25
26
# File 'lib/nrser/ext/tree.rb', line 24

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

#leavesObject

Sends ‘self` to NRSER.leaves.



10
11
12
# File 'lib/nrser/ext/tree.rb', line 10

def leaves
  NRSER.leaves self
end

#map_branches(&block) ⇒ Object

Calls NRSER.map_branches on ‘self` with `&block`.



31
32
33
# File 'lib/nrser/ext/tree.rb', line 31

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

#map_leaves(&block) ⇒ Object

Calls NRSER.map_leaves on ‘self` with `&block`.



17
18
19
# File 'lib/nrser/ext/tree.rb', line 17

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

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

Calls NRSER.map_tree on ‘self` with `&block`.



38
39
40
# File 'lib/nrser/ext/tree.rb', line 38

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