Class: AIPP::LF::AD16

Inherits:
AIP show all
Includes:
Helpers::ADRadio, Helpers::Common
Defined in:
lib/aipp/regions/LF/AD-1.6.rb

Overview

Aerodromes radiocommunication facilities (VFR only)

Constant Summary collapse

DEPENDS =
%w(AD-1.3)
ID_FIXES =
{
  'LF04' => 'LF9004',   # illegal ID as per AIXM
  'LFPY' => nil         # decommissioned - see https://fr.wikipedia.org/wiki/Base_a%C3%A9rienne_217_Br%C3%A9tigny-sur-Orge
}

Constants included from Helpers::ADRadio

Helpers::ADRadio::ADDRESS_TYPES, Helpers::ADRadio::IGNORED_TYPES, Helpers::ADRadio::SERVICE_TYPES

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::ADRadio

#addresses_from, #parts_from, #units_from

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



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/aipp/regions/LF/AD-1.6.rb', line 17

def parse
  prepare(html: read).css('tbody').first do |tbody|
    tbody.css('tr').group_by_chunks { |e| e.attr(:id).match?(/-TXT_NAME-/) }.each do |tr, trs|
      id = tr.css('span[id*="CODE_ICAO"]').text.cleanup
      next unless id = ID_FIXES.fetch(id, id)
      @airport = select(:airport, id: id).first
      addresses_from(trs).each { |a| @airport.add_address(a) }
      units_from(trs).each(&method(:add))
    end
  end
end