Class: YamlPath::PathStack
- Inherits:
-
Object
- Object
- YamlPath::PathStack
- Defined in:
- lib/yaml_path/tree_builder.rb
Instance Method Summary collapse
-
#initialize ⇒ PathStack
constructor
A new instance of PathStack.
- #match?(yaml_path_str) ⇒ Boolean
- #pop ⇒ Object
- #push(node) ⇒ Object
Constructor Details
#initialize ⇒ PathStack
Returns a new instance of PathStack.
5 6 7 |
# File 'lib/yaml_path/tree_builder.rb', line 5 def initialize @stack = ['$'] end |
Instance Method Details
#match?(yaml_path_str) ⇒ Boolean
17 18 19 |
# File 'lib/yaml_path/tree_builder.rb', line 17 def match?(yaml_path_str) yaml_path_str == @stack.join('.') end |
#pop ⇒ Object
13 14 15 |
# File 'lib/yaml_path/tree_builder.rb', line 13 def pop @stack.pop end |
#push(node) ⇒ Object
9 10 11 |
# File 'lib/yaml_path/tree_builder.rb', line 9 def push(node) @stack.push(node) end |