Class: Hotfile::Record::BKS30
- Inherits:
-
Hotfile::Record
- Object
- Hotfile::Record
- Hotfile::Record::BKS30
- Defined in:
- lib/hotfile/record/BKS30.rb
Overview
STD/Document Amounts Record
Instance Method Summary collapse
-
#initialize(line) ⇒ BKS30
constructor
A new instance of BKS30.
Constructor Details
#initialize(line) ⇒ BKS30
Returns a new instance of BKS30.
7 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 36 37 38 39 40 |
# File 'lib/hotfile/record/BKS30.rb', line 7 def initialize(line) super commissionable, net_fare, misc1_type, misc1_amount, misc2_type, misc2_amount, misc3_type, misc3_amount, amount, reserved, currency = line.scan(/ (\d{10}.) ([\d ]{10}.) ([A-Z0-9 ]{8}) ([\d ]{10}.) ([A-Z0-9 ]{8}) ([\d ]{10}.) ([A-Z0-9 ]{8}) ([\d ]{10}.) (\d{10}.) (.{2}) ([A-Z0-9]{4}) /x).flatten @data = { currency: currency.strip, amounts: { total: Hotfile::Integer.new(amount).to_i, net: Hotfile::Integer.new(net_fare).to_i, commissionable: Hotfile::Integer.new(commissionable).to_i, tax_misc: [ { type: misc1_type.strip, amount: Hotfile::Integer.new(misc1_amount).to_i }, { type: misc2_type.strip, amount: Hotfile::Integer.new(misc2_amount).to_i }, { type: misc3_type.strip, amount: Hotfile::Integer.new(misc3_amount).to_i } ].reject { |x| x[:type] == '' } }, reserved: reserved.strip } end |