Sha256: 3f8d799c36d33b85c2df032d3e06404a9aee40a07c359439ee3451dfbca23552
Contents?: true
Size: 875 Bytes
Versions: 2
Compression:
Stored size: 875 Bytes
Contents
# frozen_string_literal: true module Kugiru class Handler class_attribute :default_format self.default_format = :csv def self.call(template, source = nil) source ||= template.source <<~RUBY csv = OpenStruct.new( utf8_bom: ::Kugiru.configuration.utf8_bom, streaming: ::Kugiru.configuration.streaming, cols: {}, data: [] ) #{source} controller.send(:send_file_headers!, type: 'text/csv', filename: csv.filename) _builder_args = csv.to_h.slice(:utf8_bom, :cols, :data) if csv.streaming response.headers['Cache-Control'] = 'no-cache' response.headers['X-Accel-Buffering'] = 'no' ::Kugiru::Builder.build_enumerator(_builder_args) else ::Kugiru::Builder.build(_builder_args) end RUBY end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
kugiru-0.1.1 | lib/kugiru/handler.rb |
kugiru-0.1.0 | lib/kugiru/handler.rb |