Class: Terminal::Table

Inherits:
Object
  • Object
show all
Defined in:
lib/skytap/templates.rb

Instance Method Summary collapse

Instance Method Details

#additional_column_widthsObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/skytap/templates.rb', line 4

def additional_column_widths
  return [] if style.width.nil?
  spacing = style.width - columns_width
  if spacing < 0
    # SKYTAP: Modify this line not to raise an execption.
    return []
  else
    per_col = spacing / number_of_columns
    arr = (1...number_of_columns).to_a.map { |i| per_col }
    other_cols = arr.inject(0) { |s, i| s + i }
    arr << spacing - other_cols
    arr
  end
end