module ThousandIsland::Utilities::DeepMerge::TableOptions
Public Class Methods
merge_options(*hashes)
click to toggle source
Take a number of hashes used for Table
Options and merge them
into one, respecting the structure and nesting according to the pdf options hash. Hashes work in order of precedence, the first in the array overrides, the second, etc. @param hashes [*Hash] A number of hashes to merge, in the order of precedence @return [Hash] the merged values
# File lib/thousand_island/utilities/utilities.rb, line 70 def self.merge_options(*hashes) hashes.reverse! merged = {} footer_format = merge_for_key_and_nested_keys(:footer_format, [], *hashes) header_format = merge_for_key_and_nested_keys(:header_format, [], *hashes) cell_style = merge_for_key_and_nested_keys(:cell_style, [], *hashes) hashes.each do |h| merged.merge!(h) end merged[:footer_format] = footer_format merged[:header_format] = header_format merged[:cell_style] = cell_style merged end