class ATCTools::Aircraft

Attributes

code[R]

Aircraft code. The identifier that would be displayed on the radar scope (B732 = Boeing 737-200).

equipment[R]

Aircraft equipment code.

info[RW]

Full aircraft info string.

model[R]

Aircraft model number.

raw[R]

Raw data used to initialize the object, typically from the VRC client.

Public Class Methods

new(aircraft_code = nil, **kvargs) click to toggle source

Params:

:info, :model, :code, :equipment
-- See instance variables for descriptions.
# File lib/atc-tools/aircraft.rb, line 19
def initialize(aircraft_code = nil, **kvargs)
  @raw       = aircraft_code || kvargs.fetch(:code, '')
  @info      = kvargs.fetch :info, ''
  @model     = kvargs.fetch :model, ''
  
  params     = @raw.scan(%r{(?:([a-zA-Z]+)/)?(\w+)(?:/([a-zA-Z]+))?}).flatten
  
  @code      = kvargs.fetch(:code, nil) || params[1] || ''
  @equipment = kvargs.fetch(:equipment, nil) || params[2] || ''
end

Public Instance Methods

to_s() click to toggle source

Returns @raw.

# File lib/atc-tools/aircraft.rb, line 31
def to_s
  @raw
end