Class: AIPP::LF::AD13

Inherits:
AIP show all
Includes:
Helpers::Base
Defined in:
lib/aipp/regions/LF/AD-1.3.rb

Overview

Aerodromes

Constant Summary collapse

DEPENDS =
%w(AD-2)
ID_LESS_AIRPORTS =

Map names of id-less airports to unofficial ids

{
  "ALBE" => 'LF9001',
  "BEAUMONT DE LOMAGNE" => 'LF9002',
  "BERDOUES" => 'LF9003',
  "BOULOC" => 'LF9004',
  "BUXEUIL ST REMY / CREUSE" => 'LF9005',
  "CALVIAC" => 'LF9006',
  "CAYLUS" => 'LF9007',
  "CORBONOD" => 'LF9008',
  "L'ISLE EN DODON" => 'LF9009',
  "LACAVE LE FRAU" => 'LF9010',
  "LUCON CHASNAIS" => 'LF9011',
  "PEYRELEVADE" => 'LF9012',
  "SAINT CYR LA CAMPAGNE" => 'LF9013',
  "SEPTFONDS" => 'LF9014',
  "TALMONT VENDEE AIR PARK" => 'LF9015'
}.freeze
PURPOSES =
{
  "s" => :scheduled,
  "ns" => :not_scheduled,
  "p" =>  :private
}.freeze

Constants included from Helpers::Base

Helpers::Base::ANGLICISE_MAP, Helpers::Base::BORDERS, Helpers::Base::INTERSECTIONS, Helpers::Base::SURFACES

Instance Attribute Summary

Attributes inherited from AIP

#aip, #fixture

Instance Method Summary collapse

Methods included from Helpers::Base

#anglicise, #d_from, #elevation_from, #geometry_from, #layer_from, #organisation_lf, #prepare, #source, #timetable_from!, #xy_from, #z_from

Methods inherited from AIP

#add, #borders, #cache, #close, #config, #find, #find_by, #initialize, #options, #read

Methods included from Patcher

#attach_patches, #detach_patches, included

Constructor Details

This class inherits a constructor from AIPP::AIP

Instance Method Details

#parseObject


36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/aipp/regions/LF/AD-1.3.rb', line 36

def parse
  ad2_exists = false
  tbody = prepare(html: read).css('tbody').first   # skip altiports
  tbody.css('tr').to_enum.with_index(1).each do |tr, index|
    if tr.attr(:id).match?(/-TXT_NAME-/)
      add @airport if @airport && !ad2_exists
      @airport = airport_from tr
      verbose_info "Parsing #{@airport.id}"
      ad2_exists = false
      if airport = find_by(:airport, id: @airport.id).first
        ad2_exists = true
        @airport = airport
      end
      add_usage_limitations_from tr
      next
    end
    @airport.add_runway(runway_from(tr)) unless ad2_exists
  rescue => error
    warn("error parsing #{@airport.id} at ##{index}: #{error.message}", pry: error)
  end
  add @airport if @airport && !ad2_exists
end