9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/fast_excel_rails/template_handler.rb', line 9
def call(template, source = nil)
<<-eos
# Only build one shared workbook object so partials can take advantage
# of the same workbook by default.
root_view = false
unless @fast_excel_rails_template_workbook
@fast_excel_rails_template_workbook = FastExcel.open
root_view = true
end
# Define a local "workbook" variable for accessing things inside the
# template.
workbook = @fast_excel_rails_template_workbook
#{source || template.source}
if root_view
@fast_excel_rails_template_workbook.read_string
end
eos
end
|