Class: AIPP::LF::AD16

Inherits:
AIP show all
Includes:
Helpers::Base, Helpers::RadioAD
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::RadioAD

Helpers::RadioAD::ADDRESS_TYPES, Helpers::RadioAD::IGNORED_TYPES, Helpers::RadioAD::SERVICE_TYPES

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

#addresses_from, #units_from

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


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

def parse
  document = prepare(html: read)
  document.css('tbody').each do |tbody|
    tbody.css('tr').group_by_chunks { _1.attr(:id).match?(/-TXT_NAME-/) }.each do |tr, trs|
      trs = Nokogiri::XML::NodeSet.new(document, trs)   # convert array to node set
      id = tr.css('span[id*="CODE_ICAO"]').text.cleanup
      next unless id = ID_FIXES.fetch(id, id)
      @airport = find_by(:airport, id: id).first
      addresses_from(trs).each { @airport.add_address(_1) }
      units_from(trs, airport: @airport).each(&method(:add))
    end
  end
end