Class: Html::Table
Constant Summary
Constants inherited
from Tag
Html::Tag::ALLOWED_CHILDREN
Instance Method Summary
collapse
Methods inherited from Tag
#attributes=, #empty?, #to_s
Constructor Details
#initialize(rows = 0, cols = 0, **attrs) ⇒ Table
Returns a new instance of Table.
12
13
14
15
16
17
|
# File 'lib/html/table.rb', line 12
def initialize(rows = 0, cols = 0, **attrs)
@head_rows = []
@body_rows = Array.new(rows, Row.new(Array.new(cols, Col.new(' '))))
super(**attrs)
end
|
Instance Method Details
#value ⇒ Object
27
28
29
30
31
|
# File 'lib/html/table.rb', line 27
def value
output_value = ''
output_value += head.to_s unless head.empty?
output_value + body.to_s unless body.empty?
end
|
23
24
25
|
# File 'lib/html/table.rb', line 23
def (head_rows)
@head_rows = head_rows
end
|
#write_row(index, row) ⇒ Object
19
20
21
|
# File 'lib/html/table.rb', line 19
def write_row(index, row)
@body_rows[index] = row
end
|