Sha256: c3ab7e7d297283839e2b33023745984e98ac27d80a362bb9e2e357cb8d963d4e
Contents?: true
Size: 1.33 KB
Versions: 2
Compression:
Stored size: 1.33 KB
Contents
module Vatbook class Booking require 'nokogiri' attr_accessor :role, :callsign, :name, :cid, :start, :end, :dep, :arr attr_accessor :aircraft, :route, :enroute, :fir def initialize(booking, role, fir) @fir = fir @role = role @callsign = booking.children.css("callsign").first.children.to_s @name = booking.children.css("name").first.children.to_s @role == "atc" ? @cid = booking.children.css("cid").first.children.to_s : @cid = booking.children.css("pid").first.children.to_s if @role == "atc" @start = booking.children.css("time_start").first.children.to_s @end = booking.children.css("time_end").first.children.to_s elsif @role == "pilot" @dep = booking.children.css("dep").first.children.to_s @arr = booking.children.css("arr").first.children.to_s @route = booking.children.css("route").first.children.to_s.gsub(/[\n]/, ' ').strip @start = booking.children.css("from").first.children.to_s @end = booking.children.css("to").first.children.to_s @aircraft = booking.children.css("actype").first.children.to_s check_enroute end end private def check_enroute if @fir[0..1] == @dep[0..1] or @fir[0..1] == @arr[0..1] @enroute = false else @enroute = true end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
vatbook-0.2.1 | lib/vatbook/booking.rb |
vatbook-0.2.0 | lib/vatbook/booking.rb |