asseinfo/br_danfe

View on GitHub
lib/br_danfe/cce_lib/correction.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
module BrDanfe
  module CceLib
    class Correction
      def initialize(pdf, xml)
        @pdf = pdf
        @xml = Nokogiri::XML(xml)
      end

      def render
        @pdf.box(height: 490) do
          @pdf.text correction
        end
      end

      private

      def correction
        node = @xml.css('procEventoNFe > evento > infEvento > detEvento > xCorrecao')
        node ? node.text : ''
      end
    end
  end
end