Class: AIPP::LF::Helpers::NavigationalAid::NavigationalAid

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/aipp/regions/LF/helpers/navigational_aid.rb

Constant Summary collapse

{
  'vor' => 'vor',
  'dme' => 'dme',
  'ndb' => 'ndb',
  'tacan' => 'tacan',
  'l' => 'ndb'   # L denominates a NDB of class locator
}.freeze

Constants included from Base

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

Instance Method Summary collapse

Methods included from Base

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

Constructor Details

#initialize(tds, source:, sections:) ⇒ NavigationalAid

Returns a new instance of NavigationalAid.


22
23
24
# File 'lib/aipp/regions/LF/helpers/navigational_aid.rb', line 22

def initialize(tds, source:, sections:)
  @tds, @source, @sections = tds, source, sections
end

Instance Method Details

#buildObject


26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/aipp/regions/LF/helpers/navigational_aid.rb', line 26

def build
  master, slave = @tds[:type].text.strip.gsub(/[^\w-]/, '').downcase.split('-')
  master = NAVIGATIONAL_AIDS.fetch(master, master)
  slave = NAVIGATIONAL_AIDS.fetch(slave, slave)
  return nil unless NAVIGATIONAL_AIDS.keys.include? master
  AIXM.send(master, common.merge(send(master))).tap do |navigational_aid|
    navigational_aid.source = @source
    navigational_aid.remarks = remarks
    navigational_aid.timetable = timetable_from!(@tds[:schedule].text)
    navigational_aid.send("associate_#{slave}", channel: channel_from(@tds[:f].text)) if slave
  end
end