class SeeYouCup::Waypoint

Constants

STYLE_MAP

Attributes

code[RW]
country[RW]
desc[RW]
elev[RW]
freq[RW]
lat[R]
lon[R]
name[RW]
rwydir[RW]
rwylen[RW]

Public Instance Methods

lat=(coord) click to toggle source
# File lib/see_you_cup/waypoint.rb, line 33
def lat=(coord)
  @lat = parse_coord(coord)
end
lon=(coord) click to toggle source
# File lib/see_you_cup/waypoint.rb, line 29
def lon=(coord)
  @lon = parse_coord(coord)
end
style() click to toggle source
# File lib/see_you_cup/waypoint.rb, line 41
def style
  STYLE_MAP[@style]
end
style=(style) click to toggle source
# File lib/see_you_cup/waypoint.rb, line 37
def style=(style)
  @style = style.to_i
end

Private Instance Methods

parse_coord(coord) click to toggle source
# File lib/see_you_cup/waypoint.rb, line 47
def parse_coord(coord)
  return coord if coord.is_a?(Float)

  coord = coord.upcase.strip.gsub(/^0/, '')
  sign = %w[N E].include?(coord[-1]) ? 1 : -1
  coord.chop!
  deg = coord[0..1].to_f
  min = coord[2..7].to_f
  sign * (deg + min / 60)
end