Class: Sangi::Renderer::CellRenderer
- Inherits:
-
Object
- Object
- Sangi::Renderer::CellRenderer
- Defined in:
- lib/sangi/renderer/cell_renderer.rb
Constant Summary collapse
- CELL_WIDTH =
11- CELL_HEIGHT =
5
Instance Method Summary collapse
-
#initialize(config) ⇒ CellRenderer
constructor
A new instance of CellRenderer.
- #render(cell, row_sign: 1, slash: false) ⇒ Object
Constructor Details
#initialize(config) ⇒ CellRenderer
Returns a new instance of CellRenderer.
7 8 9 |
# File 'lib/sangi/renderer/cell_renderer.rb', line 7 def initialize(config) @config = config end |
Instance Method Details
#render(cell, row_sign: 1, slash: false) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/sangi/renderer/cell_renderer.rb', line 11 def render(cell, row_sign: 1, slash: false) lines = blank_lines if cell.value.zero? render_zero(lines) elsif cell.orientation == :vertical render_vertical(lines, cell) else render_horizontal(lines, cell) end put_char(lines, 0, 9, "/") if slash && row_sign.negative? lines end |