Class: YTools::Path::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/ytools/path/parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Parser

Returns a new instance of Parser.



43
44
45
46
# File 'lib/ytools/path/parser.rb', line 43

def initialize(path)
  @lexer = Lexer.new(path)
  @path = path
end

Instance Method Details

#parse!Object



48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/ytools/path/parser.rb', line 48

def parse!
  selector = nil

  if @lexer.has_next?
    selector = root_selector
  end

  while @lexer.has_next?
    selector.chain(child_selector)
  end

  selector
end