Class: TacviewClient::BaseProcessor

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

Overview

An Base Procesor that defines all the methods called by an instance of a TacviewClient::Reader. Use this as a guide on what you need to implement. You can also optionally inherit from this class to make sure you have every method defined in your sub-class

Instance Method Summary collapse

Instance Method Details

#delete_object(object_id) ⇒ Object

Process a delete event for an object

Parameters:

  • object_id (String)

    A hexadecimal number representing the object ID

Raises:

  • (NotImplementedError)


34
35
36
# File 'lib/tacview_client/base_processor.rb', line 34

def delete_object(object_id)
  raise NotImplementedError, 'To be implemented by subclass'
end

#set_property(property:, value:) ⇒ Object

Set a property

Parameters:

  • property (String)

    The name of the property to be set

  • value (String)

    The value of the property to be set

Raises:

  • (NotImplementedError)


50
51
52
# File 'lib/tacview_client/base_processor.rb', line 50

def set_property(property:, value:)
  raise NotImplementedError, 'To be implemented by subclass'
end

#update_object(event) ⇒ Object

Process an update event for an object

On the first appearance of the object there are usually more fields including pilot names, object type etc.

For existing objects these events are almost always lat/lon/alt updates only

Parameters:

  • event (Hash)

    A parsed ACMI line. This hash will always include the fields listed below but may also include others depending on the source line.

Options Hash (event):

  • :object_id (String)

    The hexadecimal format object ID.

  • :latitude (BigDecimal)

    The object latitude in WGS 84 format.

  • :longitude (BigDecimal)

    The object latitude in WGS 84 format.

  • :altitude (BigDecimal)

    The object altitude above sea level in meters to 1 decimal place.

Raises:

  • (NotImplementedError)


26
27
28
# File 'lib/tacview_client/base_processor.rb', line 26

def update_object(event)
  raise NotImplementedError, 'To be implemented by subclass'
end

#update_time(time) ⇒ Object

Process a time update event

Parameters:

  • time (BigDecimal)

    A time update in seconds from the ReferenceTime to 2 decimal places

Raises:

  • (NotImplementedError)


42
43
44
# File 'lib/tacview_client/base_processor.rb', line 42

def update_time(time)
  raise NotImplementedError, 'To be implemented by subclass'
end