Class: PrismChecker::Node::Hash

Inherits:
Base
  • Object
show all
Defined in:
lib/prism_checker/node/hash.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#checker, #error, #expectation, #name, #parent, #status

Instance Method Summary collapse

Methods inherited from Base

#build_expectation, #check, #check_absence, #check_wrapper, #element, #failure?, #path, #root?, #success?, #type, #wait_until_true

Constructor Details

#initialize(checker, parent, name, expectation) ⇒ Hash

Returns a new instance of Hash.



10
11
12
13
# File 'lib/prism_checker/node/hash.rb', line 10

def initialize(checker, parent, name, expectation)
  super
  @children = {}
end

Instance Attribute Details

#childrenObject (readonly)

Returns the value of attribute children.



8
9
10
# File 'lib/prism_checker/node/hash.rb', line 8

def children
  @children
end

Instance Method Details

#add_child(name, child) ⇒ Object



15
16
17
# File 'lib/prism_checker/node/hash.rb', line 15

def add_child(name, child)
  @children[name] = child
end

#walk_through(level = 0) {|_self, level| ... } ⇒ Object

Yields:

  • (_self, level)

Yield Parameters:



19
20
21
22
23
24
# File 'lib/prism_checker/node/hash.rb', line 19

def walk_through(level = 0, &block)
  yield self, level
  @children.each_value do |child|
    child.walk_through(level + 1, &block)
  end
end