Class: TablePrint::Column
- Inherits:
-
Object
- Object
- TablePrint::Column
- Defined in:
- lib/table_print-patch-pr70/column.rb
Instance Method Summary collapse
Instance Method Details
#data_width ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/table_print-patch-pr70/column.rb', line 6 def data_width if multibyte_count [ name.each_char.collect { |c| c.bytesize == 1 ? 1 : 2 }.inject(0, &:+), Array(data).compact.collect { |s| escape_strip(s.to_s) }.collect { |m| m.each_char.collect { |n| n.bytesize == 1 ? 1 : 2 }.inject(0, &:+) }.max ].compact.max || 0 else [ name.length, Array(data).compact.collect { |s| escape_strip(s.to_s) }.collect(&:length).max ].compact.max || 0 end end |