class HexaPDF::Document::Layout::CellArgumentCollector

when converting cell data to box instances.
This helper class is used by Layout#table_box to allow specifying the keyword arguments used

def []=(rows = 0..-1, cols = 0..-1, args)

either be a single number or a range of numbers.
Stores the keyword arguments in +args+ for the given 0-based rows and columns which can
def []=(rows = 0..-1, cols = 0..-1, args)
  rows = adjust_range(rows.kind_of?(Integer) ? rows..rows : rows, @number_of_rows)
  cols = adjust_range(cols.kind_of?(Integer) ? cols..cols : cols, @number_of_columns)
  @argument_infos << ArgumentInfo.new(rows, cols, args)
end

def adjust_range(range, max)

integers smaller than +max+.
Adjusts the +range+ so that both the begin and the end of the range are zero or positive
def adjust_range(range, max)
  (range.begin % max)..(range.end % max)
end

def initialize(number_of_rows, number_of_columns)

Creates a new instance, providing the number of rows and columns of the table.
def initialize(number_of_rows, number_of_columns)
  @argument_infos = []
  @number_of_rows = number_of_rows
  @number_of_columns = number_of_columns
end

def retrieve_arguments_for(row, col)

Earlier defined arguments are overridden by later ones.

Retrieves the merged keyword arguments for the cell in +row+ and +col+.
def retrieve_arguments_for(row, col)
  @argument_infos.each_with_object({}) do |arg_info, result|
    next unless arg_info.rows.cover?(row) && arg_info.cols.cover?(col)
    result.update(arg_info.args)
  end
end