Class: HtmlTable::TableBuilder::ColumnFooters

Inherits:
Object
  • Object
show all
Defined in:
lib/html_table/table_builder/column_footers.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(row, footer) ⇒ ColumnFooters

Returns a new instance of ColumnFooters.



4
5
6
7
8
# File 'lib/html_table/table_builder/column_footers.rb', line 4

def initialize(row, footer)
  @columns = row.columns
  @row = row
  @footer = footer
end

Instance Attribute Details

Returns the value of attribute footer.



2
3
4
# File 'lib/html_table/table_builder/column_footers.rb', line 2

def footer
  @footer
end

#rowObject (readonly)

Returns the value of attribute row.



2
3
4
# File 'lib/html_table/table_builder/column_footers.rb', line 2

def row
  @row
end

Instance Method Details



16
17
18
# File 'lib/html_table/table_builder/column_footers.rb', line 16

def footer_or_empty column
  footer[column] || " "
end

#to_sObject



10
11
12
13
14
# File 'lib/html_table/table_builder/column_footers.rb', line 10

def to_s
  @columns.map do |column|
    "<th>#{footer_or_empty(column)}</th>"
  end
end