Sha256: 1e76683e10b957fecb84699cb8b1e539044e1ba04d9fc7eb046072174abab46a

Contents?: true

Size: 492 Bytes

Versions: 9

Compression:

Stored size: 492 Bytes

Contents

module IOStreams
  module CSV
    class Writer
      # Write to a file / stream, compressing with GZip
      def self.open(file_name_or_io, options = {}, &block)
        unless IOStreams.writer_stream?(file_name_or_io)
          ::CSV.open(file_name_or_io, 'wb', options, &block)
        else
          begin
            csv = ::CSV.new(file_name_or_io, options)
            block.call(csv)
          ensure
            csv.close if csv
          end
        end
      end

    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
iostreams-0.14.0 lib/io_streams/csv/writer.rb
iostreams-0.13.0 lib/io_streams/csv/writer.rb
iostreams-0.12.1 lib/io_streams/csv/writer.rb
iostreams-0.12.0 lib/io_streams/csv/writer.rb
iostreams-0.11.0 lib/io_streams/csv/writer.rb
iostreams-0.10.1 lib/io_streams/csv/writer.rb
iostreams-0.10.0 lib/io_streams/csv/writer.rb
iostreams-0.9.1 lib/io_streams/csv/writer.rb
iostreams-0.9.0 lib/io_streams/csv/writer.rb