Class: Chamomile::Layout::Table

Inherits:
Base
  • Object
show all
Defined in:
lib/chamomile/layout/table.rb

Instance Method Summary collapse

Constructor Details

#initialize(data, columns: nil, height: nil) ⇒ Table

Returns a new instance of Table.



6
7
8
9
10
# File 'lib/chamomile/layout/table.rb', line 6

def initialize(data, columns: nil, height: nil)
  @data    = data
  @columns = columns
  @height  = height
end

Instance Method Details

#render(width:, height:) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/chamomile/layout/table.rb', line 12

def render(width:, height:)
  if @data.is_a?(Chamomile::Table)
    @data.view
  else
    table = build_table(width)
    table.view
  end
end