Class: Text2048::CursesView::LCD
- Inherits:
-
Object
- Object
- Text2048::CursesView::LCD
- Defined in:
- lib/text2048/curses_view/lcd.rb
Overview
Renders numbers like LCDs
Constant Summary collapse
- BITMAPS =
[ 0b111111110101011, 0b101010010001000, 0b111111100111001, 0b111111110011001, 0b101111010011010, 0b111111110010011, 0b111111110110011, 0b101011010001001, 0b111111110111011, 0b111111110011011 ]
- TOP =
0- TOP_LEFT =
1- TOP_MIDDLE =
2- TOP_RIGHT =
3- MIDDLE =
4- BOTTOM_LEFT =
5- BOTTOM_MIDDLE =
6- BOTTOM_RIGHT =
7- BOTTOM =
8- CORNER_TOP_LEFT =
9- CORNER_TOP_RIGHT =
10- CORNER_MIDDLE_LEFT =
11- CORNER_MIDDLE_RIGHT =
12- CORNER_BOTTOM_LEFT =
13- CORNER_BOTTOM_RIGHT =
14
Instance Method Summary collapse
-
#initialize(number) ⇒ LCD
constructor
A new instance of LCD.
- #render ⇒ Object
Constructor Details
#initialize(number) ⇒ LCD
Returns a new instance of LCD.
38 39 40 |
# File 'lib/text2048/curses_view/lcd.rb', line 38 def initialize(number) @number = number end |
Instance Method Details
#render ⇒ Object
42 43 44 45 |
# File 'lib/text2048/curses_view/lcd.rb', line 42 def render digits = @number.to_s.split(//).map { |each| digit(each) } digits.transpose.map { |each| each.join(' ') }.join("\n") end |