module XPath::DSL
Constants
- AXES
- LOWERCASE_LETTERS
- METHODS
- OPERATORS
- UPPERCASE_LETTERS
Public Instance Methods
Source
# File lib/xpath/dsl.rb, line 21 def anywhere(*expressions) Expression.new(:anywhere, expressions) end
Source
# File lib/xpath/dsl.rb, line 25 def attr(expression) Expression.new(:attribute, current, expression) end
Source
# File lib/xpath/dsl.rb, line 17 def axis(name, *element_names) Expression.new(:axis, current, name, element_names) end
Source
# File lib/xpath/dsl.rb, line 58 def binary_operator(name, rhs) Expression.new(:binary_operator, name, current, rhs) end
Source
# File lib/xpath/dsl.rb, line 13 def child(*expressions) Expression.new(:child, current, expressions) end
Source
# File lib/xpath/dsl.rb, line 147 def contains_word(word) function(:concat, ' ', current.normalize_space, ' ').contains(" #{word} ") end
Source
# File lib/xpath/dsl.rb, line 33 def css(selector) Expression.new(:css, current, Literal.new(selector)) end
Source
# File lib/xpath/dsl.rb, line 9 def descendant(*expressions) Expression.new(:descendant, current, expressions) end
Source
# File lib/xpath/dsl.rb, line 143 def ends_with(suffix) function(:substring, current, function(:'string-length', current).minus(function(:'string-length', suffix)).plus(1)) == suffix end
Source
# File lib/xpath/dsl.rb, line 37 def function(name, *arguments) Expression.new(:function, name, *arguments) end
Source
# File lib/xpath/dsl.rb, line 54 def is(expression) Expression.new(:is, current, expression) end
Source
# File lib/xpath/dsl.rb, line 154 def lowercase method(:translate, UPPERCASE_LETTERS, LOWERCASE_LETTERS) end
Source
# File lib/xpath/dsl.rb, line 41 def method(name, *arguments) Expression.new(:function, name, current, *arguments) end
Source
# File lib/xpath/dsl.rb, line 166 def next_sibling(*expressions) axis(:"following-sibling")[1].axis(:self, *expressions) end
Source
# File lib/xpath/dsl.rb, line 162 def one_of(*expressions) expressions.map { |e| current.equals(e) }.reduce(:or) end
Source
# File lib/xpath/dsl.rb, line 170 def previous_sibling(*expressions) axis(:"preceding-sibling")[1].axis(:self, *expressions) end
Source
# File lib/xpath/dsl.rb, line 62 def union(*expressions) Union.new(*[self, expressions].flatten) end
Also aliased as: +
Source
# File lib/xpath/dsl.rb, line 158 def uppercase method(:translate, LOWERCASE_LETTERS, UPPERCASE_LETTERS) end
Source
# File lib/xpath/dsl.rb, line 45 def where(expression) if expression Expression.new(:where, current, expression) else current end end
Also aliased as: []