Method: Nfe::Cane#initialize

Defined in:
lib/nfe_reader/product/cane.rb

#initialize(attrs = {}) ⇒ Cane

Returns a new instance of Cane.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/nfe_reader/product/cane.rb', line 6

def initialize(attrs = {})
  @harvest = attrs[:safra]
  @month = attrs[:ref]
  @month_amount = attrs[:qTotMes]
  @previous_amount = attrs[:qTotAnt]
  @amount = attrs[:qTotGer]
  @value = attrs[:vFor]
  @deduction_value = attrs[:vTotDed]
  @net_value = attrs[:vLiqFor]

  @days = []
  
  if attrs[:forDia]
    @days = to_array(attrs[:forDia])
  end

  if attrs[:deduc]
    @deductions = to_array(attrs[:deduc])
  end
end