Class: S19::MotFile
- Inherits:
-
Object
- Object
- S19::MotFile
- Defined in:
- lib/rsrec.rb
Instance Attribute Summary collapse
-
#records ⇒ Object
readonly
Returns the value of attribute records.
Class Method Summary collapse
-
.from_file(filename) ⇒ Object
Parses a .mot file in memory, returns MotFile.
Instance Method Summary collapse
-
#data_records ⇒ Object
Just the data records.
-
#image_size ⇒ Object
The total size of the image in bytes.
-
#initialize(records = []) ⇒ MotFile
constructor
A new instance of MotFile.
- #to_s ⇒ Object
Constructor Details
#initialize(records = []) ⇒ MotFile
Returns a new instance of MotFile.
134 135 136 |
# File 'lib/rsrec.rb', line 134 def initialize records=[] @records=records end |
Instance Attribute Details
#records ⇒ Object (readonly)
Returns the value of attribute records.
133 134 135 |
# File 'lib/rsrec.rb', line 133 def records @records end |
Class Method Details
Instance Method Details
#data_records ⇒ Object
Just the data records
141 142 143 |
# File 'lib/rsrec.rb', line 141 def data_records @records.select{|rec| rec.data_record?}.compact end |
#image_size ⇒ Object
The total size of the image in bytes
145 146 147 |
# File 'lib/rsrec.rb', line 145 def image_size data_records.last.address+data_records.last.binary.size-data_records.first.address end |
#to_s ⇒ Object
137 138 139 |
# File 'lib/rsrec.rb', line 137 def to_s @records.each_with_object(""){|record,msg| msg<<"#{record}\n"} end |