Method: TableGen#row

Defined in:
lib/tablegen.rb

#row(*fields) ⇒ Object

Add a row to the table. The fields are formatted with TableGen::Column#format.

Examples:

table.column 2 do |col|
  col.format = proc {|price|
    "$%.2f" % price
  }
end

# Product Name, Quantity, Price
table.row 'Table Generator', 42, 0

Parameters:

Raises:

  • at least one field is required

See Also:



101
102
103
104
# File 'lib/tablegen.rb', line 101

def row(*fields)
  raise ArgumentError, 'wrong number of arguments (0 for 1+)' if fields.empty?
  @lines << Line.new(:row, fields)
end