# File lib/asciidoctor/table.rb, line 126 def assign_col_widths width_base = nil pf = 10.0 ** 4 # precision factor (multipler / divisor) for managing precision of calculated result total_width = col_pcwidth = 0 if width_base @columns.each {|col| total_width += (col_pcwidth = col.assign_width nil, width_base, pf) } else col_pcwidth = ((100 * pf / @columns.size).to_i) / pf col_pcwidth = col_pcwidth.to_i if col_pcwidth.to_i == col_pcwidth @columns.each {|col| total_width += col.assign_width col_pcwidth } end # donate balance, if any, to final column @columns[-1].assign_width(((100 - total_width + col_pcwidth) * pf).round / pf) unless total_width == 100 nil end