Sha256: 68f7417ba8fbc056292748fa3ec4d8a84cec53e172c98c61e8126040c6286ec9

Contents?: true

Size: 689 Bytes

Versions: 10

Compression:

Stored size: 689 Bytes

Contents

module Wasabi
  module XPathHelper

    NAMESPACES = {
      "xs"     => "http://www.w3.org/2001/XMLSchema",
      "wsdl"   => "http://schemas.xmlsoap.org/wsdl/",
      "soap11" => "http://schemas.xmlsoap.org/wsdl/soap/",
      "soap12" => "http://schemas.xmlsoap.org/wsdl/soap12/"
    }

    def xpath(*args)
      node, xpath = extract_xpath_args(args)
      node.xpath(xpath, NAMESPACES)
    end

    def at_xpath(*args)
      node, xpath = extract_xpath_args(args)
      node.at_xpath(xpath, NAMESPACES)
    end

  private

    def extract_xpath_args(args)
      xpath, target = args.reverse
      target ||= document if respond_to?(:document)
      [target, xpath]
    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
wasabi-3.1.0 lib/wasabi/xpath_helper.rb
wasabi-3.0.0 lib/wasabi/xpath_helper.rb
wasabi-2.5.1 lib/wasabi/xpath_helper.rb
wasabi-2.5.0 lib/wasabi/xpath_helper.rb
wasabi-2.4.1 lib/wasabi/xpath_helper.rb
wasabi-2.4.0 lib/wasabi/xpath_helper.rb
wasabi-2.3.0 lib/wasabi/xpath_helper.rb
wasabi-2.2.0 lib/wasabi/xpath_helper.rb
wasabi-2.1.1 lib/wasabi/xpath_helper.rb
wasabi-2.1.0 lib/wasabi/xpath_helper.rb