Class: Hotfile::Record::BKI63
- Inherits:
-
Hotfile::Record
- Object
- Hotfile::Record
- Hotfile::Record::BKI63
- Defined in:
- lib/hotfile/record/BKI63.rb
Overview
Itinerary Data Segment Record
Instance Method Summary collapse
-
#initialize(line) ⇒ BKI63
constructor
A new instance of BKI63.
Constructor Details
#initialize(line) ⇒ BKI63
Returns a new instance of BKI63.
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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/hotfile/record/BKI63.rb', line 7 def initialize(line) super segment, stopover, not_valid_before, not_valid_after, departure_airport, arrival_airport, carrier, cabin, flight_number, booking_designator, departure_date, departure_time, booking_status, baggage, fare_basis, ff_ref, fare_class, change_of_gauge, equipment, reserved = line.scan(/ (\d) ([A-Z]) ([A-Z0-9 ]{5}) ([A-Z0-9 ]{5}) ([A-Z0-9 ]{5}) ([A-Z0-9 ]{5}) ([A-Z0-9 ]{3}) ([A-Z0-9 ]) ([A-Z0-9 ]{5}) ([A-Z ]{2}) ([A-Z0-9 ]{7}) ([A-Z0-9 ]{5}) ([A-Z ]{2}) ([A-Z0-9 ]{3}) ([A-Z0-9 ]{15}) ([A-Z0-9 ]{20}) ([A-Z0-9 ]{3}) ([A-Z0-9 ]) ([A-Z0-9 ]{3}) (.{4}) /x).flatten @data = { segment: segment.to_i, carrier: carrier.strip, flight_number: flight_number.strip, departure: { airport: departure_airport.strip, datetime: DateTime.parse("#{Hotfile::Date.new(departure_date).to_date} #{departure_time.strip.insert(2, ':')}") }, stopover: stopover.strip, arrival: { airport: arrival_airport.strip }, validity: { not_before: Hotfile::Date.new(not_valid_before).to_date, not_after: Hotfile::Date.new(not_valid_after).to_date }, cabin: cabin.strip, baggage: baggage.strip, equipment: equipment.strip, booking: { designator: booking_designator.strip, status: booking_status.strip, frequent_flyer_ref: ff_ref.strip, fare_basis: fare_basis.strip, fare_class: fare_class.strip, change_of_gauge: change_of_gauge.strip }, reserved: reserved.strip } end |