Method: Terminal::Table::Cell#width

Defined in:
lib/terminal-table/cell.rb

#widthObject

Returns the width of this cell



77
78
79
80
81
82
83
# File 'lib/terminal-table/cell.rb', line 77

def width
  padding = (colspan - 1) * @table.cell_spacing
  inner_width = (1..@colspan).to_a.inject(0) do |w, counter|
    w + @table.column_width(@index + counter - 1)
  end
  inner_width + padding
end