class RubyDanfe::Cst

Public Class Methods

to_danfe(xml) click to toggle source
# File lib/ruby_danfe/cst.rb, line 3
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 Class Methods

csosn?(xml) click to toggle source
# File lib/ruby_danfe/cst.rb, line 24
def self.csosn?(xml)
  xml.css("ICMS/*/CSOSN").text != ""
end
cst?(xml) click to toggle source
# File lib/ruby_danfe/cst.rb, line 20
def self.cst?(xml)
  xml.css("ICMS/*/CST").text != ""
end
origin(xml) click to toggle source
# File lib/ruby_danfe/cst.rb, line 16
def self.origin(xml)
  xml.css('ICMS/*/orig').text
end