Class: RubyXmlNfe::Items
- Inherits:
-
Object
- Object
- RubyXmlNfe::Items
- Defined in:
- lib/ruby_xml_nfe/items.rb
Instance Attribute Summary collapse
-
#infAdProd ⇒ Object
readonly
Returns the value of attribute infAdProd.
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#xml ⇒ Object
readonly
Returns the value of attribute xml.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(xml, items) ⇒ Items
constructor
A new instance of Items.
Constructor Details
#initialize(xml, items) ⇒ Items
Returns a new instance of Items.
8 9 10 11 |
# File 'lib/ruby_xml_nfe/items.rb', line 8 def initialize(xml, items) @xml = xml @items = items end |
Instance Attribute Details
#infAdProd ⇒ Object (readonly)
Returns the value of attribute infAdProd.
6 7 8 |
# File 'lib/ruby_xml_nfe/items.rb', line 6 def infAdProd @infAdProd end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
6 7 8 |
# File 'lib/ruby_xml_nfe/items.rb', line 6 def items @items end |
#xml ⇒ Object (readonly)
Returns the value of attribute xml.
6 7 8 |
# File 'lib/ruby_xml_nfe/items.rb', line 6 def xml @xml end |
Instance Method Details
#build ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/ruby_xml_nfe/items.rb', line 13 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 |