Class: Dossier::Responder

Inherits:
ActionController::Responder
  • Object
show all
Defined in:
lib/dossier/responder.rb

Instance Method Summary collapse

Instance Method Details

#respondObject



26
27
28
29
# File 'lib/dossier/responder.rb', line 26

def respond
  multi_report_html_only!
  super
end

#to_csvObject



16
17
18
19
# File 'lib/dossier/responder.rb', line 16

def to_csv
  set_content_disposition!
  controller.response_body = StreamCSV.new(*collection_and_headers(report.raw_results.arrays))
end

#to_htmlObject



7
8
9
10
# File 'lib/dossier/responder.rb', line 7

def to_html
  report.renderer.engine   = controller
  controller.response_body = report.render
end

#to_jsonObject



12
13
14
# File 'lib/dossier/responder.rb', line 12

def to_json
  controller.render json: report.results.hashes
end

#to_xlsObject



21
22
23
24
# File 'lib/dossier/responder.rb', line 21

def to_xls
  set_content_disposition!
  controller.response_body = Xls.new(*collection_and_headers(report.raw_results.arrays))
end