Class: Hotfile::Record::BAR64

Inherits:
Hotfile::Record show all
Defined in:
lib/hotfile/record/BAR64.rb

Overview

Document Amounts Record

Instance Method Summary collapse

Constructor Details

#initialize(line) ⇒ BAR64

Returns a new instance of BAR64.



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
41
# File 'lib/hotfile/record/BAR64.rb', line 7

def initialize(line)
  super

  fare, ti_indicator, equivalent_fare, total, system_id, fcm_indicator, booking_agent, outlet_type, fcp_indicator,
      issuing_agent, reserved =
    line.scan(/
      (.{12})
      (.)
      (.{12})
      (.{12})
      ([A-Z0-9 ]{4})
      ([A-Z0-9 ])
      ([A-Z0-9 ]{6})
      ([A-Z0-9 ])
      ([A-Z0-9 ])
      ([A-Z0-9 ]{8})
      (.{38})
    /x).flatten

  @data = {
    fare: fare.strip,
    equivalent_fare: equivalent_fare.strip,
    total_fare: total.strip,
    system_id: system_id.strip,
    booking_agent: booking_agent.strip,
    outlet_type: outlet_type.strip,
    issuing_agent: issuing_agent.strip,
    indicators: {
      ti: ti_indicator.strip,
      fcm: fcm_indicator.strip,
      fcp: fcp_indicator.strip
    },
    reserved: reserved.strip
  }
end