Sha256: 9ff81342c8b91fb3b316ddae0735a657e89d7fc7d7d3b741c1a4e931ff4941ca

Contents?: true

Size: 426 Bytes

Versions: 2

Compression:

Stored size: 426 Bytes

Contents

module Xporter
  class Exporter
    module Streaming
      extend ActiveSupport::Concern

      class_methods do
        def stream(*args)
          new.stream(*args)
        end
      end

      def stream(collection, stream)
        stream.write CSV.generate_line(headers)

        @collection = collection

        content.each do |row|
          stream.write CSV.generate_line(row)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
xporter-0.2.0 lib/xporter/exporter/streaming.rb
xporter-0.1.0 lib/xporter/exporter/streaming.rb