Class: Hotfile::Record::BKS42
- Inherits:
-
Hotfile::Record
- Object
- Hotfile::Record
- Hotfile::Record::BKS42
- Defined in:
- lib/hotfile/record/BKS42.rb
Overview
Tax on Commission Record ! not tested, I hope this code works at all…
Instance Method Summary collapse
-
#initialize(line) ⇒ BKS42
constructor
A new instance of BKS42.
Constructor Details
#initialize(line) ⇒ BKS42
Returns a new instance of BKS42.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/hotfile/record/BKS42.rb', line 8 def initialize(line) super type1, amount1, type2, amount2, type3, amount3, type4, amount4, reserved, currency = line.scan(/ ([A-Z0-9 ]{6}) ([\d ]{10}.) ([A-Z0-9 ]{6}) ([\d ]{10}.) ([A-Z0-9 ]{6}) ([\d ]{10}.) ([A-Z0-9 ]{6}) ([\d ]{10}.) (.{24}) ([A-Z0-9]{4}) /x).flatten @data = { currency: currency.strip, taxes: [ { type: type1.strip, amount: Hotfile::Integer.new(amount1).to_i }, { type: type2.strip, amount: Hotfile::Integer.new(amount2).to_i }, { type: type3.strip, amount: Hotfile::Integer.new(amount3).to_i }, { type: type4.strip, amount: Hotfile::Integer.new(amount4).to_i } ].reject { |x| x[:type] == '' }, reserved: reserved.strip } end |