Class: Ephem::IO::EndiannessManager
- Inherits:
-
Object
- Object
- Ephem::IO::EndiannessManager
- Defined in:
- lib/ephem/io/endianness_manager.rb
Constant Summary collapse
- FORMATS =
Mapping of format to endianness
{ "BIG-IEEE" => :big, "LTL-IEEE" => :little }.freeze
- FTPSTR =
Fixed-length Transfer Protocol String
"FTPSTR:\r:\n:\r\n:\r\x00:\x81:\x10\xce:ENDFTP".b.freeze
Instance Method Summary collapse
- #detect_endianness ⇒ Object
-
#initialize(file_record) ⇒ EndiannessManager
constructor
A new instance of EndiannessManager.
Constructor Details
#initialize(file_record) ⇒ EndiannessManager
Returns a new instance of EndiannessManager.
15 16 17 18 |
# File 'lib/ephem/io/endianness_manager.rb', line 15 def initialize(file_record) @file_record = file_record @locator_identifier = extract_locator_identifier end |
Instance Method Details
#detect_endianness ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/ephem/io/endianness_manager.rb', line 20 def detect_endianness case @locator_identifier when "NAIF/DAF" then detect_from_naif_daf when /\ADAF\// then detect_from_daf_prefix else raise FileFormatError, "Invalid file identifier: #{@locator_identifier.inspect}" end end |