Sha256: 45110cf222a32e28bf6e54a6c6ad9f4c407ec4b8d12002302473c4f52ab653e9
Contents?: true
Size: 780 Bytes
Versions: 16
Compression:
Stored size: 780 Bytes
Contents
module BrDanfe module DanfeLib class XML def css(xpath) @xml.css(xpath) end def initialize(xml) @xml = Nokogiri::XML(xml) end def [](xpath) node = @xml.css(xpath) return node ? node.text : "" end def collect(ns, tag, &block) result = [] # Tenta primeiro com uso de namespace begin @xml.xpath("//#{ns}:#{tag}").each do |det| result << yield(det) end rescue # Caso dĂȘ erro, tenta sem @xml.xpath("//#{tag}").each do |det| result << yield(det) end end result end def version_310? @xml.css("infNFe").attr("versao").to_s == "3.10" end end end end
Version data entries
16 entries across 16 versions & 1 rubygems