Class: XPath::Expression::NextSibling
- Inherits:
-
Multiple
- Object
- XPath::Expression
- Multiple
- XPath::Expression::NextSibling
- Defined in:
- lib/xpath/expression.rb
Constant Summary
Constants included from XPath
Instance Method Summary collapse
Methods inherited from Multiple
Methods inherited from XPath::Expression
#and, #apply, #current, #equals, #inverse, #is, #next_sibling, #normalize, #one_of, #or, #string_literal, #to_s, #to_xpaths, #union, #where, #wrap_xpath
Methods included from XPath
#anywhere, #attr, #child, #contains, #css, #current, #descendant, generate, #name, #string, #tag, #text, #var, #varstring
Constructor Details
This class inherits a constructor from XPath::Expression::Multiple
Instance Method Details
#to_xpath(predicate = nil) ⇒ Object
66 67 68 69 70 71 72 73 74 |
# File 'lib/xpath/expression.rb', line 66 def to_xpath(predicate=nil) if @expressions.length == 1 "#{@left.to_xpath(predicate)}/following-sibling::*[1]/self::#{@expressions.first.to_xpath(predicate)}" elsif @expressions.length > 1 "#{@left.to_xpath(predicate)}/following-sibling::*[1]/self::*[#{@expressions.map { |e| "self::#{e.to_xpath(predicate)}" }.join(" | ")}]" else "#{@left.to_xpath(predicate)}/following-sibling::*[1]/self::*" end end |