Class: HexFile::Record
- Inherits:
-
Object
- Object
- HexFile::Record
- Defined in:
- lib/hex_file/record.rb
Constant Summary collapse
- DATA =
'00'- END_OF_FILE =
'01'- EXTENDED_SEGMENT_ADDRESS =
'02'- START_SEGMENT_ADDRESS =
'03'- EXTENDED_LINEAR_ADDRESS =
'04'- START_LINEAR_ADDRESS =
'05'
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#byte_count ⇒ Object
readonly
Returns the value of attribute byte_count.
-
#checksum ⇒ Object
readonly
Returns the value of attribute checksum.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #data_size ⇒ Object
-
#initialize(record_ascii) ⇒ Record
constructor
A new instance of Record.
- #ok? ⇒ Boolean
Constructor Details
#initialize(record_ascii) ⇒ Record
14 15 16 |
# File 'lib/hex_file/record.rb', line 14 def initialize(record_ascii) parse(record_ascii) end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
12 13 14 |
# File 'lib/hex_file/record.rb', line 12 def address @address end |
#byte_count ⇒ Object (readonly)
Returns the value of attribute byte_count.
12 13 14 |
# File 'lib/hex_file/record.rb', line 12 def byte_count @byte_count end |
#checksum ⇒ Object (readonly)
Returns the value of attribute checksum.
12 13 14 |
# File 'lib/hex_file/record.rb', line 12 def checksum @checksum end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
12 13 14 |
# File 'lib/hex_file/record.rb', line 12 def data @data end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
12 13 14 |
# File 'lib/hex_file/record.rb', line 12 def type @type end |
Instance Method Details
#data_size ⇒ Object
18 19 20 |
# File 'lib/hex_file/record.rb', line 18 def data_size @byte_count.to_i(16) end |
#ok? ⇒ Boolean
22 23 24 |
# File 'lib/hex_file/record.rb', line 22 def ok? @checksum.to_i(16) == calculate_checksum end |