module BrInvoicesPdf::Util::XmlLocate

Public Instance Methods

locate_element(xml, path) click to toggle source
# File lib/br_invoices_pdf/util/xml_locate.rb, line 8
def locate_element(xml, path)
  element = xml.locate(path).first
  element.text if element.is_a?(Ox::Element)
end
node_locate(element, path) click to toggle source
# File lib/br_invoices_pdf/util/xml_locate.rb, line 17
def node_locate(element, path)
  value = element.nodes.first.locate(path).first
  value.text if value.is_a?(Ox::Element)
end
root_path(xml) click to toggle source
# File lib/br_invoices_pdf/util/xml_locate.rb, line 13
def root_path(xml)
  xml.name == 'NFe' ? 'infNFe' : 'NFe/infNFe'
end