Sha256: 477ac38476e664dbefc0054c5d0f832bcba1e2c9c7edc3c20c4163362fa6c783

Contents?: true

Size: 411 Bytes

Versions: 1

Compression:

Stored size: 411 Bytes

Contents

require "gogo_csv/version"

module GogoCsv
  require 'csv'

  def read(path)
    CSV.read(
      File.expand_path(path)
    )
  end

  class ::Array

    def save!(path)
      raise 'should be array of array' unless arys?
      CSV.open(File.expand_path(path), "wb") do |csv|
        each { |ary| csv <<  ary }
      end
    end

    private def arys?
      all? { |item| item.is_a?(Array) }
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gogo_csv-0.0.1 lib/gogo_csv.rb