11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/rmatrix/printing/print_table.rb', line 11
def to_s
widths = self.column_widths
self.row_count.times.map do |row|
self.column_count.times.flat_map do |column|
cell_text = cell_repr(self.cells[[column, row]])
justification = column_justification(column)
width = widths[column]
contents = case justification
when :left then cell_text.ljust(width)
when :right then cell_text.rjust(width)
end
[contents,self.separators[[column, row]]]
end[0...-1].join
end.join("\n")
end
|