Sha256: 053df7f92b7b89df1db49cef00e5d3d44da88e0e46c3ad73ce9afc3797deee72

Contents?: true

Size: 487 Bytes

Versions: 1

Compression:

Stored size: 487 Bytes

Contents

module GogoCsv
  class ::Array
    def save!(path=nil)
      raise 'should be array of array' unless arys?
      raise 'Should supply file path' unless path ||= $current_path

      CSV.open(File.expand_path(path), "wb") do |csv|
        each { |ary| csv <<  ary }
      end
    end

    def map_cal(from_num, to_num=from_num, &blk)
      map { |row| row[to_num] = blk.(row[from_num]) }
    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.4 lib/gogo_csv/array.rb