lib/mws/orders/document.rb in mws-orders-0.4.0 vs lib/mws/orders/document.rb in mws-orders-0.5.0

- old
+ new

@@ -1,9 +1,10 @@ # frozen_string_literal: true module MWS module Orders + # Wraps a Nokogiri node class Document attr_reader :node def initialize(node) @node = node @@ -11,16 +12,17 @@ def xpath(path) node.xpath(add_namespace(path)) end + def at_xpath(path) + node.at_xpath(add_namespace(path)) + end + private def add_namespace(path) - path - .split('/') - .map { |attr| "xmlns:#{attr}" } - .join('/') + path.split('/').map { |attr| "xmlns:#{attr}" }.join('/') end end end end