Class: PrismChecker::Node::Hash
- Defined in:
- lib/prism_checker/node/hash.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
readonly
Returns the value of attribute children.
Attributes inherited from Base
#checker, #error, #expectation, #name, #parent, #status
Instance Method Summary collapse
- #add_child(name, child) ⇒ Object
-
#initialize(checker, parent, name, expectation) ⇒ Hash
constructor
A new instance of Hash.
- #walk_through(level = 0) {|_self, level| ... } ⇒ Object
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
#children ⇒ Object (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
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 |