Module: ThousandIsland::Utilities::DeepMerge::TemplateOptions
Class Method Summary
collapse
merge_for_key_and_nested_keys
Class Method Details
.merge_body(*hashes) ⇒ Object
54
55
56
|
# File 'lib/thousand_island/utilities/utilities.rb', line 54
def self.merge_body(*hashes)
merge_for_key_and_nested_keys(:body, [], *hashes)
end
|
45
46
47
48
|
# File 'lib/thousand_island/utilities/utilities.rb', line 45
def self.(*hashes)
keys = [:numbering_options, :style]
merge_for_key_and_nested_keys(:footer, keys, *hashes)
end
|
50
51
52
|
# File 'lib/thousand_island/utilities/utilities.rb', line 50
def self.(*hashes)
merge_for_key_and_nested_keys(:header, [], *hashes)
end
|
.merge_options(*hashes) ⇒ Hash
Take a number of hashes used for Template 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.
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/thousand_island/utilities/utilities.rb', line 30
def self.merge_options(*hashes)
hashes.reverse!
merged = {}
= (*hashes)
= (*hashes)
body = merge_body(*hashes)
hashes.each do |h|
merged.merge!(h)
end
merged[:footer] =
merged[:header] =
merged[:body] = body
merged
end
|