Sha256: bf54fdd8eeea6fb9514702c61ce2e44bd605500856fa14240678f62576c107ae
Contents?: true
Size: 795 Bytes
Versions: 11
Compression:
Stored size: 795 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_is_310_or_newer? @xml.css("infNFe").attr("versao").to_s.to_f >= 3.10 end end end end
Version data entries
11 entries across 11 versions & 1 rubygems