lib/cloudxls-rails/handlers/csv.rb in cloudxls-rails-0.4.1 vs lib/cloudxls-rails/handlers/csv.rb in cloudxls-rails-0.4.2
- old
+ new
@@ -1,8 +1,8 @@
-# CloudXLSRails::CSVStream
+# CloudXLSRails::CSVResponder
module CloudXLSRails
- class CSVStream
+ class CSVResponder
def initialize(controller, stream)
@controller = controller
@stream = stream
end
@@ -34,11 +34,11 @@
ActionController::Renderers.add :csv do |scope, options|
filename = options.fetch(:filename, "data-#{DateTime.now.to_s}.csv")
columns = options[:columns]
if options[:stream] == true
- CloudXLSRails::CSVStream.stream!(self, scope, options)
+ CloudXLSRails::CSVResponder.stream!(self, scope, options)
else # no stream:
data = CloudXLS::CSVWriter.text(scope, {:columns => columns})
send_data data,
type: Mime::CSV,
@@ -47,10 +47,10 @@
end
class ActionController::Responder
def to_csv
if options[:stream] == true
- CloudXLSRails::CSVStream.stream!(controller, resources.last, options)
+ CloudXLSRails::CSVResponder.stream!(controller, resources.last, options)
else
controller.render({:csv => resources.last, :stream => false }.merge(options))
end
end
end
\ No newline at end of file