Method: Dashes::Table#total_width

Defined in:
lib/dashes.rb

#total_widthObject



91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/dashes.rb', line 91

def total_width
  if @rows.empty?
    0
  elsif @width
    @width
  else
    width = col_widths.reduce { |a,b| a+b }
    cols = @rows.first.size
    twidth = width + (2 * cols) + (cols + 1)
    @max_width ? [twidth, @max_width].min : twidth
  end
end