Module: JPath::Parser

Defined in:
lib/jpath/parser.rb,
lib/jpath/parser/path.rb,
lib/jpath/parser/step.rb,
lib/jpath/parser/formula.rb

Defined Under Namespace

Classes: Attribute, Child, Contains, Descendant, Formula, Last, Literal, Node, Number, Operator, Path, Position, Predicate, Root, Self, Step, Union

Class Method Summary collapse

Class Method Details

.expressions(s) ⇒ Object



23
24
25
# File 'lib/jpath/parser.rb', line 23

def self.expressions(s)
  enum_for(:each_expression, s).to_a
end

.path(s) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/jpath/parser.rb', line 4

def self.path(s)
  unless s.is_a?(StringScanner)
    s = StringScanner.new(s)
  end
  Path.new do |path|
    each_step(s) do |step|
      path << step
    end
  end
end

.predicates(s) ⇒ Object



15
16
17
# File 'lib/jpath/parser.rb', line 15

def self.predicates(s)
  enum_for(:each_predicate, s).to_a
end

.steps(s) ⇒ Object



19
20
21
# File 'lib/jpath/parser.rb', line 19

def self.steps(s)
  enum_for(:each_step, s).to_a
end