Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/trellohub/core_ext/array.rb

Instance Method Summary collapse

Instance Method Details

#max_lengthsObject



2
3
4
5
6
7
8
9
# File 'lib/trellohub/core_ext/array.rb', line 2

def max_lengths
  self.each_with_object([]) do |line, obj|
    line.each.with_index do |v, i|
      length = v.to_s.width
      obj[i] = length if obj[i].nil? || obj[i] < length
    end
  end
end