Method: MdnQuery::Table#add_row

Defined in:
lib/mdn_query/table.rb

#add_row(row) ⇒ void

This method returns an undefined value.

Adds a row to the body of the table.

When the size of the row is smaller than the current table size, it is padded with empty strings to that size. When the size is greater than the current table size, the entire table is padded with empty strings to that size.



37
38
39
40
41
42
43
44
45
46
# File 'lib/mdn_query/table.rb', line 37

def add_row(row)
  if row.size < @size
    row.fill('', row.size...@size)
  elsif row.size > @size
    @heading.fill('', @size...row.size)
    @body.each { |r| r.fill('', @size...row.size) }
    @size = row.size
  end
  @body << row
end