Class | Terminal::Table::Row |
In: |
lib/terminal-table/row.rb
lib/terminal-table/row.rb |
Parent: | Object |
Initialize with width and options.
# File lib/terminal-table/row.rb, line 15 15: def initialize table, array = [] 16: @cell_index = 0 17: @table = table 18: @cells = [] 19: array.each { |item| self << item } 20: end
Initialize with width and options.
# File lib/terminal-table/row.rb, line 15 15: def initialize table, array = [] 16: @cell_index = 0 17: @table = table 18: @cells = [] 19: array.each { |item| self << item } 20: end
# File lib/terminal-table/row.rb, line 22 22: def add_cell item 23: options = item.is_a?(Hash) ? item : {:value => item} 24: cell = Cell.new(options.merge(:index => @cell_index, :table => @table)) 25: @cell_index += cell.colspan 26: @cells << cell 27: end
# File lib/terminal-table/row.rb, line 22 22: def add_cell item 23: options = item.is_a?(Hash) ? item : {:value => item} 24: cell = Cell.new(options.merge(:index => @cell_index, :table => @table)) 25: @cell_index += cell.colspan 26: @cells << cell 27: end
# File lib/terminal-table/row.rb, line 34 34: def height 35: cells.map { |c| c.lines.count }.max 36: end
# File lib/terminal-table/row.rb, line 34 34: def height 35: cells.map { |c| c.lines.count }.max 36: end