Methods

Files

XPath::Expression::Applied

Public Class Methods

new(expression, variables={}) click to toggle source
# File lib/xpath/expression.rb, line 210
def initialize(expression, variables={})
  @variables = variables
  @expression = expression
end

Public Instance Methods

to_xpath(predicate=nil) click to toggle source
# File lib/xpath/expression.rb, line 215
def to_xpath(predicate=nil)
  @expression.to_xpath(predicate) % @variables
rescue ArgumentError # for ruby < 1.9 compat
  @expression.to_xpath(predicate).gsub(/%\{(\w+)\}/) do |_|
    @variables[$1.to_sym] or raise(ArgumentError, "expected variable #{$1} to be set")
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.