Class: BoardRenderer
- Inherits:
-
Object
- Object
- BoardRenderer
- Defined in:
- lib/sapphire-chess/board/board_renderer.rb
Constant Summary collapse
- LEFT_MARGIN =
4
- RIGHT_MARGIN =
3
- EMPTY_ROW_0 =
'| |'
- EMPTY_ROW_0_WHITE =
'|████████|'
- EMPTY_ROW =
' |'
- EMPTY_ROW_WHITE =
'████████|'
- FLOOR_0 =
'+--------+'
- FLOOR =
'--------+'
- COLUMN_LETTERS =
('a'..'h').to_a.freeze
- ROW_NUMBERS =
[*('1'..'8')].reverse
Instance Method Summary collapse
-
#initialize(board) ⇒ BoardRenderer
constructor
A new instance of BoardRenderer.
- #render ⇒ Object
Constructor Details
#initialize(board) ⇒ BoardRenderer
Returns a new instance of BoardRenderer.
16 17 18 19 |
# File 'lib/sapphire-chess/board/board_renderer.rb', line 16 def initialize(board) @board = board @square_order = board.class::SQUARE_ORDER end |
Instance Method Details
#render ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/sapphire-chess/board/board_renderer.rb', line 21 def render print_column_letters print_floor print_rows new_line print_column_letters end |