Method: NOTAM::Item.type

Defined in:
lib/notam/item.rb

.type(text) ⇒ String

Analyses the raw NOTAM item text and detect its type.

Examples:

NOTAM::Item.type('A0135/20 NOTAMN')   # => :Header
NOTAM::Item.type('B) 0208231540')     # => :B
NOTAM::Item.type('SOURCE: LFNT')      # => :Footer
NOTAM::Item.type('foobar')            # => NOTAM::ParseError

Returns:

  • (String)

Raises:



70
71
72
73
74
75
76
77
# File 'lib/notam/item.rb', line 70

def type(text)
  case text.strip
    when /\A([A-GQ])\)/ then $1
    when NOTAM::Header::RE then 'Header'
    when NOTAM::Footer::RE then 'Footer'
    else fail(NOTAM::ParseError, 'item not recognized')
  end.to_sym
end