Class: YamlPath::PathStack

Inherits:
Object
  • Object
show all
Defined in:
lib/yaml_path/tree_builder.rb

Instance Method Summary collapse

Constructor Details

#initializePathStack

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

Returns:

  • (Boolean)


17
18
19
# File 'lib/yaml_path/tree_builder.rb', line 17

def match?(yaml_path_str)
  yaml_path_str == @stack.join('.')
end

#popObject



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