Class: OdroidLCD::HWMock
- Inherits:
-
Object
- Object
- OdroidLCD::HWMock
- Defined in:
- lib/odroid_lcd/hw_mock.rb
Instance Attribute Summary collapse
-
#max_column ⇒ Object
readonly
Returns the value of attribute max_column.
-
#max_row ⇒ Object
readonly
Returns the value of attribute max_row.
Instance Method Summary collapse
- #clear ⇒ Object
-
#get(row: 0) ⇒ Object
Extra methods for use as a mock.
-
#initialize ⇒ HWMock
constructor
A new instance of HWMock.
- #set_character(row, column, character) ⇒ Object
Constructor Details
#initialize ⇒ HWMock
Returns a new instance of HWMock.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/odroid_lcd/hw_mock.rb', line 7 def initialize @max_column = 16 @max_row = 2 @display = [ [], [] ] end |
Instance Attribute Details
#max_column ⇒ Object (readonly)
Returns the value of attribute max_column.
4 5 6 |
# File 'lib/odroid_lcd/hw_mock.rb', line 4 def max_column @max_column end |
#max_row ⇒ Object (readonly)
Returns the value of attribute max_row.
5 6 7 |
# File 'lib/odroid_lcd/hw_mock.rb', line 5 def max_row @max_row end |
Instance Method Details
#clear ⇒ Object
18 19 20 21 22 23 |
# File 'lib/odroid_lcd/hw_mock.rb', line 18 def clear @display = [ [], [] ] end |
#get(row: 0) ⇒ Object
Extra methods for use as a mock
41 42 43 |
# File 'lib/odroid_lcd/hw_mock.rb', line 41 def get(row: 0) @display[row] end |
#set_character(row, column, character) ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/odroid_lcd/hw_mock.rb', line 27 def set_character(row, column, character) chr = case character when "\u005c" then "\u00a5" when "\u007e" then "\u2192" when "\u007f" then "\u2190" else character end @display[row][column] = chr end |