Class: Sangi::Renderer::AsciiRenderer

Inherits:
Object
  • Object
show all
Defined in:
lib/sangi/renderer/ascii_renderer.rb

Constant Summary collapse

LABEL_WIDTH =
7
CELL_WIDTH =
CellRenderer::CELL_WIDTH

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ AsciiRenderer

Returns a new instance of AsciiRenderer.



7
8
9
10
# File 'lib/sangi/renderer/ascii_renderer.rb', line 7

def initialize(config)
  @config = config
  @cell_renderer = CellRenderer.new(config)
end

Instance Method Details

#render(step, total_steps:) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/sangi/renderer/ascii_renderer.rb', line 12

def render(step, total_steps:)
  lines = []
  lines.concat(header_lines(step, total_steps))
  lines << ""
  lines.concat(message_lines(step))
  lines << ""
  lines.concat(board_lines(step.board))
  lines << ""
  lines.concat(value_lines(step.board))
  lines << ""
  lines << "keys: n next / p prev / r reset / e end / a auto / q quit / ? help"
  lines.join("\n") + "\n"
end