Sha256: 54761d018bae6eb3f15cf906678910d33ef297ceb1e078b1ae4fad1af50320bf

Contents?: true

Size: 485 Bytes

Versions: 9

Compression:

Stored size: 485 Bytes

Contents

require 'csv'
module IOStreams
  module CSV
    class Reader
      # Read from a file or stream
      def self.open(file_name_or_io, options = Hash.new, &block)
        unless IOStreams.reader_stream?(file_name_or_io)
          ::CSV.open(file_name_or_io, 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/reader.rb
iostreams-0.13.0 lib/io_streams/csv/reader.rb
iostreams-0.12.1 lib/io_streams/csv/reader.rb
iostreams-0.12.0 lib/io_streams/csv/reader.rb
iostreams-0.11.0 lib/io_streams/csv/reader.rb
iostreams-0.10.1 lib/io_streams/csv/reader.rb
iostreams-0.10.0 lib/io_streams/csv/reader.rb
iostreams-0.9.1 lib/io_streams/csv/reader.rb
iostreams-0.9.0 lib/io_streams/csv/reader.rb