16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/mondrian_rest/api_formatters.rb', line 16
def self.call(result, env)
add_parents = env['rack.request.query_hash']['parents'] == 'true'
debug = env['rack.request.query_hash']['debug'] == 'true'
out = StringIO.new
book = WriteExcel.new(out)
sheet = book.add_worksheet
Mondrian::REST::Formatters
.tidy(result,
add_parents: add_parents,
debug: debug)
.each_with_index do |row, i|
row.each_with_index { |cell, j|
sheet.write(i, j, cell)
}
end
book.close
out.string
end
|