Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/gogo_csv/array.rb
Instance Method Summary collapse
Instance Method Details
#map_col!(from_num, to_num = from_num, &blk) ⇒ Object
12 13 14 |
# File 'lib/gogo_csv/array.rb', line 12 def map_col!(from_num, to_num=from_num, &blk) each { |row| row[to_num] = blk.(row[from_num]) } end |
#save!(path = nil) ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/gogo_csv/array.rb', line 3 def save!(path=nil) raise 'should be array of array' unless arys? raise 'Should supply file path' unless path ||= $current_path CSV.open(File.(path), "wb") do |csv| each { |ary| csv << ary } end end |