Class: IOStreams::CSV::Writer
- Inherits:
-
Object
- Object
- IOStreams::CSV::Writer
- Defined in:
- lib/io_streams/csv/writer.rb
Class Method Summary collapse
-
.open(file_name_or_io, options = {}, &block) ⇒ Object
Write to a file / stream, compressing with GZip.
Class Method Details
.open(file_name_or_io, options = {}, &block) ⇒ Object
Write to a file / stream, compressing with GZip
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/io_streams/csv/writer.rb', line 5 def self.open(file_name_or_io, = {}, &block) unless IOStreams.writer_stream?(file_name_or_io) ::CSV.open(file_name_or_io, 'wb', , &block) else begin csv = ::CSV.new(file_name_or_io, ) block.call(csv) ensure csv.close if csv end end end |