Module: NRSER::Ext::Tree

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.



21
22
23
# File 'lib/nrser/ext/tree.rb', line 21

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

#leavesObject

Sends ‘self` to NRSER.leaves.



7
8
9
# File 'lib/nrser/ext/tree.rb', line 7

def leaves
  NRSER.leaves self
end

#map_branches(&block) ⇒ Object

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



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

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

#map_leaves(&block) ⇒ Object

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



14
15
16
# File 'lib/nrser/ext/tree.rb', line 14

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

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

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



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

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