Class: AIPP::LF::AD13

Inherits:
AIP show all
Includes:
Helpers::Common
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'
}

Constants included from Helpers::Common

Helpers::Common::ANGLICISE_MAP, Helpers::Common::BORDERS, Helpers::Common::INTERSECTIONS, Helpers::Common::SURFACES

Instance Attribute Summary

Attributes inherited from AIP

#aip, #fixture

Instance Method Summary collapse

Methods included from Helpers::Common

#anglicise, #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, #initialize, #options, #read, #select

Methods included from Patcher

#attach_patches, #detach_patches

Constructor Details

This class inherits a constructor from AIPP::AIP

Instance Method Details

#parseObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/aipp/regions/LF/AD-1.3.rb', line 30

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 = select(: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