Sha256: a7f99698af2dd1f025d7ccfa4864dee7678b4fbe9ebddbb6287dcd2be44a72ed
Contents?: true
Size: 696 Bytes
Versions: 2
Compression:
Stored size: 696 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 def fetch(dir) all_files = Dir[dir+'/*'].select {|x| x =~ /_.*(csv)/ } actual_names = [] all_files.each do |path| actual_names << File.basename(path) end actual_names 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
csv_uploader_tool-0.1.2 | lib/csv_uploader_tool/csv_stream.rb |
csv_uploader_tool-0.1.1 | lib/csv_uploader_tool/csv_stream.rb |