Class: Lab42::Console::H

Inherits:
Object show all
Extended by:
Tools::ForwardToNewInstance
Defined in:
lib/lab42/console/h.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Tools::ForwardToNewInstance

method_missing

Instance Attribute Details

#hashObject (readonly)

Returns the value of attribute hash.



7
8
9
# File 'lib/lab42/console/h.rb', line 7

def hash
  @hash
end

Instance Method Details

#find(*keys) ⇒ Object



9
10
11
# File 'lib/lab42/console/h.rb', line 9

def find *keys
  prewalk hash 
end

#pre_walk(nodes, condition, visitor, visited: Set.new) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/lab42/console/h.rb', line 13

def pre_walk nodes, condition, visitor, visited: Set.new
  return if visisted.includes? nodes
  case nodes
  when Hash
    walk_hash_pairs nodes, condition, visitor, visited: visited
  when Enumerable
    nodes.each do |ele|
      pre_walk ele, condition, visitor, visited: visited.add(ele)
    end
  end
end