Module: Akami::XPathHelper

Included in:
WSSE::Signature
Defined in:
lib/akami/xpath_helper.rb

Instance Method Summary collapse

Instance Method Details

#at_xpath(node, xpath) ⇒ Object



3
4
5
6
# File 'lib/akami/xpath_helper.rb', line 3

def at_xpath(node, xpath)
  return unless node
  node.at_xpath local_name_xpath(xpath)
end

#local_name_xpath(xpath) ⇒ Object



13
14
15
# File 'lib/akami/xpath_helper.rb', line 13

def local_name_xpath(xpath)
  xpath.gsub(%r{([/]*)([A-Za-z]+)([/]*)}) { "#{$1}*[local-name()='#{$2}']#{$3}" }
end

#xpath(node, xpath) ⇒ Object



8
9
10
11
# File 'lib/akami/xpath_helper.rb', line 8

def xpath(node, xpath)
  return unless node
  node.xpath local_name_xpath(xpath)
end