Class: Ephem::IO::SummaryManager
- Inherits:
-
Object
- Object
- Ephem::IO::SummaryManager
- Defined in:
- lib/ephem/io/summary_manager.rb
Overview
The SummaryManager class handles the parsing and iteration of summary records in a Double Precision Array File (DAF). It manages the extraction of summary records and their associated names, handling both little and big endian formats.
Each summary record consists of:
-
Control information (24 bytes)
-
Multiple summary entries (variable length)
-
Associated name entries in the following record
The class provides iteration capabilities over all summaries in the file, handling record chains and proper binary unpacking based on the file’s endianness.
Constant Summary collapse
- SUMMARY_RECORD_SIZE =
1024
- VALID_ENDIANNESS =
[:little, :big].freeze
Instance Method Summary collapse
-
#each_summary {|name, values| ... } ⇒ Enumerator?
Iterates through each summary in the DAF file.
-
#initialize(record_data:, binary_reader:, endianness:) ⇒ SummaryManager
constructor
Initializes a new SummaryManager instance.
Constructor Details
#initialize(record_data:, binary_reader:, endianness:) ⇒ SummaryManager
Initializes a new SummaryManager instance
55 56 57 58 59 60 61 |
# File 'lib/ephem/io/summary_manager.rb', line 55 def initialize(record_data:, binary_reader:, endianness:) validate_endianness!(endianness) @record_data = record_data @binary_reader = binary_reader @endianness = endianness setup_summary_format end |
Instance Method Details
#each_summary {|name, values| ... } ⇒ Enumerator?
Iterates through each summary in the DAF file
This method traverses the chain of summary records, extracting both the summary data and associated names. It handles proper binary unpacking based on the file’s endianness and the record format specification.
If no block is given, returns an Enumerator for the summaries.
80 81 82 83 84 85 86 |
# File 'lib/ephem/io/summary_manager.rb', line 80 def each_summary return to_enum(__method__) unless block_given? iterate_summary_chain(@record_data.forward_record) do |name, values| yield name, values end end |