Class: Msp430Bsl::DataFile
- Inherits:
-
Object
- Object
- Msp430Bsl::DataFile
- Defined in:
- lib/msp430_bsl/data_file.rb
Direct Known Subclasses
Constant Summary collapse
- LINE_DATA_SIZE =
Configs::PURE_DATA_MAX_SIZE
Instance Attribute Summary collapse
-
#lines ⇒ Object
readonly
Returns the value of attribute lines.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#raw_data ⇒ Object
readonly
Returns the value of attribute raw_data.
Instance Method Summary collapse
- #<<(line) ⇒ Object
- #add_new_lines_from(data, starting_addr) ⇒ Object
-
#initialize ⇒ DataFile
constructor
A new instance of DataFile.
- #line_data_size ⇒ Object
- #new_line_from(data, addr, type: :data) ⇒ Object
Constructor Details
#initialize ⇒ DataFile
Returns a new instance of DataFile.
8 9 10 |
# File 'lib/msp430_bsl/data_file.rb', line 8 def initialize @lines = [] end |
Instance Attribute Details
#lines ⇒ Object (readonly)
Returns the value of attribute lines.
6 7 8 |
# File 'lib/msp430_bsl/data_file.rb', line 6 def lines @lines end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
6 7 8 |
# File 'lib/msp430_bsl/data_file.rb', line 6 def path @path end |
#raw_data ⇒ Object (readonly)
Returns the value of attribute raw_data.
6 7 8 |
# File 'lib/msp430_bsl/data_file.rb', line 6 def raw_data @raw_data end |
Instance Method Details
#<<(line) ⇒ Object
20 21 22 |
# File 'lib/msp430_bsl/data_file.rb', line 20 def <<(line) @lines << line end |
#add_new_lines_from(data, starting_addr) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/msp430_bsl/data_file.rb', line 12 def add_new_lines_from(data, starting_addr) curr_addr = starting_addr data.each_slice(line_data_size) do |slice| @lines << new_line_from(slice, curr_addr) curr_addr += line_data_size end end |
#line_data_size ⇒ Object
24 25 26 |
# File 'lib/msp430_bsl/data_file.rb', line 24 def line_data_size self.class::LINE_DATA_SIZE end |
#new_line_from(data, addr, type: :data) ⇒ Object
28 29 30 |
# File 'lib/msp430_bsl/data_file.rb', line 28 def new_line_from(data, addr, type: :data) raise NotImplementedError, 'You must implement this method in a subclass' end |