Class: Ephem::IO::DAF

Inherits:
Object
  • Object
show all
Defined in:
lib/ephem/io/daf.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_object) ⇒ DAF

Returns a new instance of DAF.



8
9
10
11
12
# File 'lib/ephem/io/daf.rb', line 8

def initialize(file_object)
  @binary_reader = BinaryReader.new(file_object)
  setup_file_format
  setup_summary_manager
end

Instance Attribute Details

#binary_readerObject (readonly)

Returns the value of attribute binary_reader.



6
7
8
# File 'lib/ephem/io/daf.rb', line 6

def binary_reader
  @binary_reader
end

#endiannessObject (readonly)

Returns the value of attribute endianness.



6
7
8
# File 'lib/ephem/io/daf.rb', line 6

def endianness
  @endianness
end

#record_dataObject (readonly)

Returns the value of attribute record_data.



6
7
8
# File 'lib/ephem/io/daf.rb', line 6

def record_data
  @record_data
end

Instance Method Details

#closeObject



38
39
40
# File 'lib/ephem/io/daf.rb', line 38

def close
  @binary_reader&.close
end

#commentsObject



14
15
16
# File 'lib/ephem/io/daf.rb', line 14

def comments
  @comments ||= load_comments
end

#file_typeSymbol?

Returns:

  • (Symbol, nil)


19
20
21
# File 'lib/ephem/io/daf.rb', line 19

def file_type
  @file_type ||= detect_file_type
end

#read_array(start_word, end_word) ⇒ Object Also known as: map_array



29
30
31
32
33
34
35
# File 'lib/ephem/io/daf.rb', line 29

def read_array(start_word, end_word)
  @binary_reader.read_array(
    start_word: start_word,
    end_word: end_word,
    endianness: @endianness
  )
end

#summaries(&block) ⇒ Object



23
24
25
26
27
# File 'lib/ephem/io/daf.rb', line 23

def summaries(&block)
  return enum_for(:summaries) unless block_given?

  @summary_manager.each_summary(&block)
end