### Home Classes Methods

### In Files

- lib/terminal-table/row.rb

### Parent

Object

### Methods

- ::new
- #<<
- #[]
- #add_cell
- #height
- #render

### Files

- README.rdoc

### Class/Module Index

Quicksearch

- Terminal
- Terminal::Table
- Terminal::Table::Cell
- Terminal::Table::Row
- Terminal::Table::Separator
- Terminal::Table::Style
- Terminal::Table::TableHelper
- Object
- String

No matching classes.

# Terminal::Table::Row

### Attributes

cells[R]

Row cells

table[R]

### Public Class Methods

new(table, array = []) click to toggle source

Initialize with width and options.

    # File lib/terminal-table/row.rb, line 15
    def initialize table, array = []
      @cell_index = 0
      @table = table
      @cells = []
      array.each { |item| self << item }
    end

### Public Instance Methods

<<(item) click to toggle source
Alias for: add_cell
[](index) click to toggle source

    # File lib/terminal-table/row.rb, line 30
    def [] index
      cells[index]
    end

add_cell(item) click to toggle source

    # File lib/terminal-table/row.rb, line 22
    def add_cell item
      options = item.is_a?(Hash) ? item : {:value => item}
      cell = Cell.new(options.merge(:index => @cell_index, :table => @table))
      @cell_index += cell.colspan
      @cells << cell
    end

Also aliased as: <<
height() click to toggle source

    # File lib/terminal-table/row.rb, line 34
    def height
      cells.map { |c| c.lines.count }.max
    end

render() click to toggle source

    # File lib/terminal-table/row.rb, line 38
    def render
      y = @table.style.border_y
      (0...height).to_a.map do |line|
        y + cells.map do |cell|
          cell.render(line)
        end.join(y) + y
      end.join("\n")
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.