Class: Hotfile::Record::BAR65

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

Overview

Additional Information–Passenger Record

Instance Method Summary collapse

Constructor Details

#initialize(line) ⇒ BAR65

Returns a new instance of BAR65.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/hotfile/record/BAR65.rb', line 7

def initialize(line)
  super

  name, passenger_data, date_of_birth, type, reserved =
    line.scan(/
      (.{49})
      (.{29})
      ([A-Z0-9 ]{7})
      ([A-Z0-9 ]{3})
      (.{8})
    /x).flatten

  @data = {
    name: name.strip,
    passenger_data: passenger_data.strip,
    date_of_birth: Hotfile::Date.new(date_of_birth).to_date,
    type: type.strip,
    reserved: reserved.strip
  }
end