Method: Prawn::Table::Cell#max_width

Defined in:
lib/prawn/table/cell.rb

#max_widthObject

Maximum width of the entire span group this cell controls.



97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/prawn/table/cell.rb', line 97

def max_width
  return max_width_ignoring_span if @colspan == 1

  # Sum the smallest max-width from each column in the group, including
  # myself.
  max_widths = Hash.new(0)
  dummy_cells.each do |cell|
    max_widths[cell.column] =
      [max_widths[cell.column], cell.max_width].min
  end
  max_widths[column] = [max_widths[column], max_width_ignoring_span].min
  max_widths.values.inject(0, &:+)
end