Module: NRSER::Refinements::Tree

Defined in:
lib/nrser/refinements/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.



44
45
46
# File 'lib/nrser/refinements/tree.rb', line 44

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

#leavesObject

Sends ‘self` to NRSER.leaves.



30
31
32
# File 'lib/nrser/refinements/tree.rb', line 30

def leaves
  NRSER.leaves self
end

#map_branches(&block) ⇒ Object

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



51
52
53
# File 'lib/nrser/refinements/tree.rb', line 51

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

#map_leaves(&block) ⇒ Object

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



37
38
39
# File 'lib/nrser/refinements/tree.rb', line 37

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

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

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



58
59
60
# File 'lib/nrser/refinements/tree.rb', line 58

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