Class: Charming::Markdown::TableRenderer
- Inherits:
-
Object
- Object
- Charming::Markdown::TableRenderer
- Defined in:
- lib/charming/presentation/markdown/table_renderer.rb
Overview
TableRenderer formats parsed Markdown table rows for terminal display.
Instance Method Summary collapse
-
#initialize(rows:, style:) ⇒ TableRenderer
constructor
A new instance of TableRenderer.
- #render ⇒ Object
Constructor Details
#initialize(rows:, style:) ⇒ TableRenderer
Returns a new instance of TableRenderer.
7 8 9 10 |
# File 'lib/charming/presentation/markdown/table_renderer.rb', line 7 def initialize(rows:, style:) @rows = rows @style = style end |
Instance Method Details
#render ⇒ Object
12 13 14 15 16 |
# File 'lib/charming/presentation/markdown/table_renderer.rb', line 12 def render return "" if rows.empty? rows.each_with_index.map { |row, index| render_row(row, index) }.join("\n") end |