class AIXM::Z

Height, elevation or altitude

@example

AIXM.z(1000, :qfe)   # height (ft): 1000 ft above ground
AIXM.z(2000, :qnh)   # elevation or altitude (ft): 2000 ft above mean sea level
AIXM.z(45, :qne)     # altitude: flight level 45

Shortcuts:

Constants

CODES

Attributes

alt[R]

@return [Integer] altitude or elevation value

code[R]

@return [Symbol] Q code - either :qfe (height in feet), :qnh (altitude in feet or :qne (altitude as flight level)

Public Class Methods

new(alt, code) click to toggle source
   # File lib/aixm/z.rb
30 def initialize(alt, code)
31   self.alt, self.code = alt, code
32 end

Public Instance Methods

==(other) click to toggle source

@see Object#== @return [Boolean]

   # File lib/aixm/z.rb
80 def ==(other)
81   self.class === other && alt == other.alt && code == other.code
82 end
Also aliased as: eql?
alt=(value) click to toggle source
   # File lib/aixm/z.rb
44 def alt=(value)
45   fail(ArgumentError, "invalid alt") unless value.is_a? Numeric
46   @alt = value.to_i
47 end
code=(value) click to toggle source
   # File lib/aixm/z.rb
49 def code=(value)
50   fail(ArgumentError, "invalid code") unless value.respond_to? :to_sym
51   @code = value.to_sym.downcase
52   fail(ArgumentError, "invalid code") unless CODES.include? @code
53 end
eql?(other)
Alias for: ==
ground?() click to toggle source

@return [Boolean] whether ground level or not

   # File lib/aixm/z.rb
69 def ground?
70   qfe? && @alt == 0
71 end
hash() click to toggle source

@see Object#hash @return [Integer]

   # File lib/aixm/z.rb
87 def hash
88   to_s.hash
89 end
inspect() click to toggle source

@return [String]

   # File lib/aixm/z.rb
35 def inspect
36   %Q(#<#{self.class} #{to_s}>)
37 end
to_s() click to toggle source

@return [String] human readable representation (e.g. “FL045” or “1350 ft QNH”)

   # File lib/aixm/z.rb
40 def to_s
41   qne? ? "FL%03i" % alt : [alt, unit, code.upcase].join(' ')
42 end
unit() click to toggle source

@return [Symbol] unit - either :fl (flight level) or :ft (feet)

   # File lib/aixm/z.rb
74 def unit
75   qne? ? :fl : :ft
76 end