Class: PrismChecker::Node::Array

Inherits:
Base
  • Object
show all
Defined in:
lib/prism_checker/node/array.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) ⇒ Array

Returns a new instance of Array.



9
10
11
12
# File 'lib/prism_checker/node/array.rb', line 9

def initialize(checker, parent, name, expectation)
  super
  @children = []
end

Instance Attribute Details

#childrenObject (readonly)

Returns the value of attribute children.



7
8
9
# File 'lib/prism_checker/node/array.rb', line 7

def children
  @children
end

Instance Method Details

#add_child(idx, child) ⇒ Object



14
15
16
# File 'lib/prism_checker/node/array.rb', line 14

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

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

Yields:

  • (_self, level)

Yield Parameters:



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

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