Class: JPath::Parser::Step
- Inherits:
-
Object
- Object
- JPath::Parser::Step
show all
- Defined in:
- lib/jpath/parser/step.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(name) ⇒ Step
Returns a new instance of Step.
9
10
11
12
|
# File 'lib/jpath/parser/step.rb', line 9
def initialize(name)
@name = name
@predicates = []
end
|
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
5
6
7
|
# File 'lib/jpath/parser/step.rb', line 5
def name
@name
end
|
#predicates ⇒ Object
Returns the value of attribute predicates.
7
8
9
|
# File 'lib/jpath/parser/step.rb', line 7
def predicates
@predicates
end
|
Instance Method Details
#+(other) ⇒ Object
18
19
20
|
# File 'lib/jpath/parser/step.rb', line 18
def +(other)
other.add(self)
end
|
#<<(predicate) ⇒ Object
22
23
24
|
# File 'lib/jpath/parser/step.rb', line 22
def <<(predicate)
@predicates << predicate
end
|
#to_s ⇒ Object
26
27
28
|
# File 'lib/jpath/parser/step.rb', line 26
def to_s
"%s::%s%s" % [axis, name, predicates.map(&:to_s).join("")]
end
|
#wildcard? ⇒ Boolean
14
15
16
|
# File 'lib/jpath/parser/step.rb', line 14
def wildcard?
name == '*'
end
|