Class: Html::Table

Inherits:
Tag
  • Object
show all
Defined in:
lib/html/table.rb

Instance Method Summary collapse

Methods inherited from Tag

#attributes=, #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)
  super(**attrs)

  @head_rows = Row.new(Array.new(0))
  @body_rows = Array.new(rows, Row.new(Array.new(cols, Col.new)))
end

Instance Method Details

#write_header(head_rows) ⇒ Object



23
24
25
# File 'lib/html/table.rb', line 23

def write_header(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