Sha256: 7b98354b57e8d55e347bb31d0d70a526ac7974bfc4c705c64adef877e6465cc2

Contents?: true

Size: 476 Bytes

Versions: 1

Compression:

Stored size: 476 Bytes

Contents

class CsvStream

  BUFFER_SIZE = 1024

  def initialize(file)
    @file = file
  end

  class << self
    def write(stream, dir, filename)
      file = CsvMaker.create_file(dir, filename)
      file_stream = CsvStream.new(file)
      file_stream.write stream
      file_stream.close
      file.path
    end
  end

  def write(stream)
    while(bytes = stream.read(BUFFER_SIZE))
      @file.write bytes
    end
  end

  def close
    @file.close unless @file.closed?
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
csv_uploader_tool-0.1.0 lib/csv_uploader_tool/csv_stream.rb