class CsvShaperHandler
CsvShaperHandler
Template handler for Rails
Public Class Methods
Source
# File lib/csv_shaper_handler.rb, line 12 def self.call(template, source = nil) %{ if ( controller.present? ) && !( defined?(ActionMailer) && defined?(ActionMailer::Base) && controller.is_a?(ActionMailer::Base) ) @filename ||= "\#{controller.action_name}.csv" controller.response.headers["Content-Type"] ||= 'text/csv' controller.response.headers['Content-Disposition'] = "attachment; filename=\\\"\#{@filename}\\\"" end CsvShaperTemplate.encode(self) do |csv| #{source || template.source} end } end
Expected ‘call` class method Set response headers with filename Primarily calls CsvShaperTemplate.encode
, passing through the context (self)