Sha256: debe49b6c0510e367769cfdfd9fb0bc0608267b4dde4b3ea3bb853fd1b01ec80

Contents?: true

Size: 504 Bytes

Versions: 21

Compression:

Stored size: 504 Bytes

Contents

# frozen_string_literal: true

module BrInvoicesPdf
  module Util
    module XmlLocate
      module_function

      def locate_element(xml, path)
        element = xml.locate(path).first
        element.text if element.is_a?(Ox::Element)
      end

      def root_path(xml)
        xml.name == 'NFe' ? 'infNFe' : 'NFe/infNFe'
      end

      def node_locate(element, path)
        value = element.nodes.first.locate(path).first
        value.text if value.is_a?(Ox::Element)
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
br_invoices_pdf-0.2.24 lib/br_invoices_pdf/util/xml_locate.rb
br_invoices_pdf-0.2.23 lib/br_invoices_pdf/util/xml_locate.rb
br_invoices_pdf-0.2.22 lib/br_invoices_pdf/util/xml_locate.rb
br_invoices_pdf-0.2.21 lib/br_invoices_pdf/util/xml_locate.rb
br_invoices_pdf-0.2.20 lib/br_invoices_pdf/util/xml_locate.rb
br_invoices_pdf-0.2.19 lib/br_invoices_pdf/util/xml_locate.rb
br_invoices_pdf-0.2.18 lib/br_invoices_pdf/util/xml_locate.rb
br_invoices_pdf-0.2.17 lib/br_invoices_pdf/util/xml_locate.rb
br_invoices_pdf-0.2.16 lib/br_invoices_pdf/util/xml_locate.rb
br_invoices_pdf-0.2.15 lib/br_invoices_pdf/util/xml_locate.rb
br_invoices_pdf-0.2.14 lib/br_invoices_pdf/util/xml_locate.rb
br_invoices_pdf-0.2.14.alpha.23 lib/br_invoices_pdf/util/xml_locate.rb
br_invoices_pdf-0.2.13 lib/br_invoices_pdf/util/xml_locate.rb
br_invoices_pdf-0.2.13.alpha.22 lib/br_invoices_pdf/util/xml_locate.rb
br_invoices_pdf-0.2.12.alpha.21 lib/br_invoices_pdf/util/xml_locate.rb
br_invoices_pdf-0.2.12.alpha.20 lib/br_invoices_pdf/util/xml_locate.rb
br_invoices_pdf-0.2.12 lib/br_invoices_pdf/util/xml_locate.rb
br_invoices_pdf-0.2.11 lib/br_invoices_pdf/util/xml_locate.rb
br_invoices_pdf-0.2.10 lib/br_invoices_pdf/util/xml_locate.rb
br_invoices_pdf-0.2.9 lib/br_invoices_pdf/util/xml_locate.rb