Class: Nfe::Cane
- Inherits:
-
Object
- Object
- Nfe::Cane
- Defined in:
- lib/nfe_reader/product/cane.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#days ⇒ Object
readonly
Returns the value of attribute days.
-
#deduction_value ⇒ Object
readonly
Returns the value of attribute deduction_value.
-
#deductions ⇒ Object
readonly
Returns the value of attribute deductions.
-
#harvest ⇒ Object
readonly
Returns the value of attribute harvest.
-
#month ⇒ Object
readonly
Returns the value of attribute month.
-
#month_amount ⇒ Object
readonly
Returns the value of attribute month_amount.
-
#net_value ⇒ Object
readonly
Returns the value of attribute net_value.
-
#previous_amount ⇒ Object
readonly
Returns the value of attribute previous_amount.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ Cane
constructor
A new instance of Cane.
- #to_array(attrs = {}) ⇒ Object
Constructor Details
#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 |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
3 4 5 |
# File 'lib/nfe_reader/product/cane.rb', line 3 def amount @amount end |
#days ⇒ Object (readonly)
Returns the value of attribute days.
3 4 5 |
# File 'lib/nfe_reader/product/cane.rb', line 3 def days @days end |
#deduction_value ⇒ Object (readonly)
Returns the value of attribute deduction_value.
3 4 5 |
# File 'lib/nfe_reader/product/cane.rb', line 3 def deduction_value @deduction_value end |
#deductions ⇒ Object (readonly)
Returns the value of attribute deductions.
3 4 5 |
# File 'lib/nfe_reader/product/cane.rb', line 3 def deductions @deductions end |
#harvest ⇒ Object (readonly)
Returns the value of attribute harvest.
3 4 5 |
# File 'lib/nfe_reader/product/cane.rb', line 3 def harvest @harvest end |
#month ⇒ Object (readonly)
Returns the value of attribute month.
3 4 5 |
# File 'lib/nfe_reader/product/cane.rb', line 3 def month @month end |
#month_amount ⇒ Object (readonly)
Returns the value of attribute month_amount.
3 4 5 |
# File 'lib/nfe_reader/product/cane.rb', line 3 def month_amount @month_amount end |
#net_value ⇒ Object (readonly)
Returns the value of attribute net_value.
3 4 5 |
# File 'lib/nfe_reader/product/cane.rb', line 3 def net_value @net_value end |
#previous_amount ⇒ Object (readonly)
Returns the value of attribute previous_amount.
3 4 5 |
# File 'lib/nfe_reader/product/cane.rb', line 3 def previous_amount @previous_amount end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
3 4 5 |
# File 'lib/nfe_reader/product/cane.rb', line 3 def value @value end |
Instance Method Details
#to_array(attrs = {}) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/nfe_reader/product/cane.rb', line 27 def to_array(attrs = {}) array = [] if attrs.is_a? Array attrs.each do |hash| array << hash.map { |key, value| value } end else array << attrs.map { |key, value| value } end array end |