Class: NMEAPlus::AISMessageFactory
- Inherits:
-
MessageFactory
- Object
- MessageFactory
- NMEAPlus::AISMessageFactory
- Defined in:
- lib/nmea_plus/ais_message_factory.rb
Overview
Defines a factory for AIS messages, which will all use Message::AIS::AISMessage as their base. The factory extracts the NMEA data type (prefixed by a 2-character “talker ID”), and looks for a class with that name within the NMEA message namespace.
Class Method Summary collapse
-
.alternate_data_type(data_type) ⇒ Array
Match all AIS messages as their generic counterparts.
-
.parent_module ⇒ String
The name of the parent module: AIS.
Methods inherited from MessageFactory
best_match_for_data_type, create, dynamically_get_message_object, message_class_exists?, message_class_name
Class Method Details
.alternate_data_type(data_type) ⇒ Array
Match all AIS messages as their generic counterparts. AIVDM becomes VDM, etc.
20 21 22 23 |
# File 'lib/nmea_plus/ais_message_factory.rb', line 20 def self.alternate_data_type(data_type) # match last 3 digits (get rid of talker) [data_type[2..4]] end |
.parent_module ⇒ String
Returns The name of the parent module: AIS.
13 14 15 |
# File 'lib/nmea_plus/ais_message_factory.rb', line 13 def self.parent_module "AIS" end |