Sha256: ecab67da56a1935bc307ddd0111da44a53ebdb40681d5fba9c0ad2c860db5aad

Contents?: true

Size: 576 Bytes

Versions: 1

Compression:

Stored size: 576 Bytes

Contents

require 'ruby_xml_nfe/prod'
require 'ruby_xml_nfe/imposto'

module RubyXmlNfe
  class Items
    attr_reader :xml, :items, :infAdProd

    def initialize(xml, items)
      @xml = xml
      @items = items
    end

    def build
      items.map.with_index do |item, index|
        xml.det(nItem: index + 1) do
          prod = RubyXmlNfe::Prod.new(xml, item[:prod])
          prod.build

          imposto = RubyXmlNfe::Imposto.new(xml, item[:imposto])
          imposto.build

          xml.infAdProd item[:infAdProd] if item[:infAdProd]
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby_xml_nfe-0.1.0 lib/ruby_xml_nfe/items.rb