Sha256: 3aea68ec2bab961ba507f97695745e9d063bde135c7d56c688fc8a3b702ba410

Contents?: true

Size: 547 Bytes

Versions: 27

Compression:

Stored size: 547 Bytes

Contents

module BrDanfe
  module DanfeLib
    class Cst
      def self.to_danfe(xml)
        value = origin(xml)

        if csosn?(xml)
          value += xml.css("ICMS/*/CSOSN").text
        elsif cst?(xml)
          value += xml.css("ICMS/*/CST").text
        end

        value
      end

      private
      def self.origin(xml)
        xml.css("ICMS/*/orig").text
      end

      def self.cst?(xml)
        xml.css("ICMS/*/CST").text != ""
      end

      def self.csosn?(xml)
        xml.css("ICMS/*/CSOSN").text != ""
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
br_danfe-0.11.1 lib/br_danfe/danfe_lib/cst.rb
br_danfe-0.11.0 lib/br_danfe/danfe_lib/cst.rb
br_danfe-0.10.1 lib/br_danfe/danfe_lib/cst.rb
br_danfe-0.10.0 lib/br_danfe/danfe_lib/cst.rb
br_danfe-0.8.0 lib/br_danfe/danfe_lib/cst.rb
br_danfe-0.7.7 lib/br_danfe/danfe_lib/cst.rb
br_danfe-0.7.6 lib/br_danfe/danfe_lib/cst.rb
br_danfe-0.7.5 lib/br_danfe/danfe_lib/cst.rb
br_danfe-0.7.4 lib/br_danfe/danfe_lib/cst.rb
br_danfe-0.7.3 lib/br_danfe/danfe_lib/cst.rb
br_danfe-0.7.2 lib/br_danfe/danfe_lib/cst.rb
br_danfe-0.7.1 lib/br_danfe/danfe_lib/cst.rb
br_danfe-0.7.0 lib/br_danfe/danfe_lib/cst.rb
br_danfe-0.6.1 lib/br_danfe/danfe_lib/cst.rb
br_danfe-0.6.0 lib/br_danfe/danfe_lib/cst.rb
br_danfe-0.5.2 lib/br_danfe/danfe_lib/cst.rb
br_danfe-0.5.1 lib/br_danfe/danfe_lib/cst.rb
br_danfe-0.5.0 lib/br_danfe/danfe_lib/cst.rb
br_danfe-0.4.3 lib/br_danfe/danfe_lib/cst.rb
br_danfe-0.4.2 lib/br_danfe/danfe_lib/cst.rb