because table_format consists of nested hashes, a deep copy of the data is necessary if any of our methods are to use Hash#delete, which the column options code uses copiously
The problematic code is here:
def draw_table(table_data, format_opts={})
m = "PDF Formatter requires column_names to be defined"
raise FormatterError, m if table_data.column_names.empty?
table_data.rename_columns { |c| c.to_s }
# if table_format[:something] is a hash, it's not duplicated, so doing
# format_opts[:something].delete(:something_else) effects the original
# table_format object
format_opts = table_format.merge(format_opts) if table_format
Tentative fix, without tests:
if table_format
format_opts = Marshal.load(Marshal.dump(table_format.merge(format_opts)))
end
We should look for this issue in other areas of Ruport, but this fixes the specific problem I ran into.
To reproduce the issue, try setting up a template which sets column headers to bold, then run draw_table twice.