Class: TacviewClient::Reader::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/tacview_client/reader/parser.rb

Overview

Parses an event coming out of the Tacview server when they are too complicated for simple extraction.

Not to be used directly by library users, should only be called by an instance of the Reader class

See www.tacview.net/documentation/acmi/en/ for information of the Tacview ACMI format this module is parsing

Constant Summary collapse

HEX_NUMBER =
/\h+/.freeze
OPTIONALLY_DECIMAL_NUMBER =
/-?\d+\.?\d+/.freeze
POSITION_START_INDICATOR =
/T=/.freeze
POSITION_SEPARATOR =
/\|/.freeze
FIELD_SEPARATOR =
/,/.freeze
END_OF_FILE =
/$/.freeze
END_OF_FIELD =
Regexp.union(FIELD_SEPARATOR, END_OF_FILE)

Instance Method Summary collapse

Instance Method Details

#parse_object_update(line) ⇒ Object

Parse an ACMI line associated with the update of an object.



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/tacview_client/reader/parser.rb', line 26

def parse_object_update(line)
  @scanner = StringScanner.new(line)
  @result = {}

  parse_object_id

  return nil if own_vehicle_message?

  parse_lon_lat_alt
  parse_heading
  parse_fields

  @result
end