Class: TableHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/coursegen/course/helpers/table_helpers.rb

Instance Method Summary collapse

Constructor Details

#initialize(property) ⇒ TableHelper

Returns a new instance of TableHelper.



2
3
4
5
# File 'lib/coursegen/course/helpers/table_helpers.rb', line 2

def initialize(property)
  @prop = property
  @bm = BootstrapMarkup.new
end

Instance Method Details

#headers(*labels) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/coursegen/course/helpers/table_helpers.rb', line 7

def headers(*labels)
  css_style = @prop == :normal ? "table-condensed" : ""
  @bm.table_begin(css_style)
  @bm.headers_begin
  labels.each do |h|
    @bm.header_begin
    @bm.header_content(h)
    @bm.header_end
  end
  @bm.headers_end
end

#renderObject



29
30
31
32
# File 'lib/coursegen/course/helpers/table_helpers.rb', line 29

def render()
  @bm.table_end
  @bm.render
end

#row(*cells) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'lib/coursegen/course/helpers/table_helpers.rb', line 19

def row(*cells)
  @bm.row_begin
  cells.each do |c|
    @bm.cell_begin
    @bm.cell_content(c)
    @bm.cell_end
  end
  @bm.row_end
end