Method: TableGen#column

Defined in:
lib/tablegen.rb

#column(index) {|Column column| ... } ⇒ Column

Yields and returns the column at the specified index.

Examples:

Change the alignment of the first column

table.column 0 do |col|
  col.alignment = :right
end

Parameters:

  • index (Fixnum)

Yields:

Returns:

  • (Column)

    the requested column

See Also:



52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/tablegen.rb', line 52

def column(index)
  unless col = @columns[index]
    if @columns.count < index
      # create columns so the holes are not filled with nil
      (@columns.count..index).each {|i| column i }
    end

    col = Column.new index
    @columns[index] = col
  end

  yield col if block_given?
  col
end