Sha256: 5bc6102ffb1a0cb6a55019fa56077b7f76906d56422521b007c0ac3d86264c00

Contents?: true

Size: 536 Bytes

Versions: 10

Compression:

Stored size: 536 Bytes

Contents

require 'tempfile'

module RocketJob
  module Sliced
    class Output < Slices
      def download(header_line: nil)
        raise(ArgumentError, 'Block is mandatory') unless block_given?

        # Write the header line
        yield(header_line) if header_line

        # Call the supplied block for every record returned
        record_count = 0
        each do |slice|
          slice.each do |record|
            record_count += 1
            yield(record)
          end
        end
        record_count
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rocketjob-5.1.1 lib/rocket_job/sliced/output.rb
rocketjob-5.1.0 lib/rocket_job/sliced/output.rb
rocketjob-5.0.0 lib/rocket_job/sliced/output.rb
rocketjob-5.0.0.rc1 lib/rocket_job/sliced/output.rb
rocketjob-5.0.0.beta4 lib/rocket_job/sliced/output.rb
rocketjob-5.0.0.beta3 lib/rocket_job/sliced/output.rb
rocketjob-5.0.0.beta2 lib/rocket_job/sliced/output.rb
rocketjob-5.0.0.beta lib/rocket_job/sliced/output.rb
rocketjob-4.3.0.beta2 lib/rocket_job/sliced/output.rb
rocketjob-4.3.0.beta lib/rocket_job/sliced/output.rb