Module: ThousandIsland::Utilities::DeepMerge::TableOptions
- Extended by:
- ThousandIsland::Utilities::DeepMerge
- Defined in:
- lib/thousand_island/utilities/utilities.rb
Class Method Summary collapse
-
.merge_options(*hashes) ⇒ Hash
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.
Methods included from ThousandIsland::Utilities::DeepMerge
Class Method Details
.merge_options(*hashes) ⇒ Hash
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.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/thousand_island/utilities/utilities.rb', line 70 def self.(*hashes) hashes.reverse! merged = {} = 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] = merged[:header_format] = header_format merged[:cell_style] = cell_style merged end |