Class: SimpleMetarParser::Runway

Inherits:
Base
  • Object
show all
Defined in:
lib/simple_metar_parser/metar/runway.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#parent

Instance Method Summary collapse

Methods inherited from Base

#initialize, #post_process

Constructor Details

This class inherits a constructor from SimpleMetarParser::Base

Instance Attribute Details

#runwaysObject (readonly)

Returns the value of attribute runways.



10
11
12
# File 'lib/simple_metar_parser/metar/runway.rb', line 10

def runways
  @runways
end

Instance Method Details

#decode_split(s) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/simple_metar_parser/metar/runway.rb', line 12

def decode_split(s)
  # TODO add variable vis. http://stoivane.iki.fi/metar/

  if s =~ /R(.{2})\/P(\d{4})(.)/
    h = {
      :runway => $1,
      :visual_range => $2.to_i
    }

    if $3 == "N"
    elsif $3 == "U"
      h[:change] = :up
    elsif $3 == "D"
      h[:change] = :down
    end

    @runways << h

  end

end

#resetObject



6
7
8
# File 'lib/simple_metar_parser/metar/runway.rb', line 6

def reset
  @runways = Array.new
end