Class: HexFile::Info
- Inherits:
-
Object
- Object
- HexFile::Info
- Defined in:
- lib/hex_file/info.rb
Instance Method Summary collapse
- #binary_size ⇒ Object
- #format ⇒ Object
-
#initialize(input_stream) ⇒ Info
constructor
A new instance of Info.
- #records ⇒ Object
Constructor Details
#initialize(input_stream) ⇒ Info
Returns a new instance of Info.
3 4 5 6 7 |
# File 'lib/hex_file/info.rb', line 3 def initialize(input_stream) @records = input_stream.readlines.map do |record_line| Record.new(record_line.strip) end end |
Instance Method Details
#binary_size ⇒ Object
13 14 15 |
# File 'lib/hex_file/info.rb', line 13 def binary_size records.map { |r| r.data_size }.reduce(:+) end |
#format ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/hex_file/info.rb', line 17 def format if linear_record_types?(record_types) 'I32HEX' elsif start_segment_record_type?(record_types) 'I16HEX' else 'I8HEX' end end |
#records ⇒ Object
9 10 11 |
# File 'lib/hex_file/info.rb', line 9 def records @records.each end |