Module: Zsave

Defined in:
lib/zaphire.rb

Class Method Summary collapse

Class Method Details

.csv(arr, file, mode = 'w', _opts = {}) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/zaphire.rb', line 34

def self.csv(arr, file, mode = 'w', _opts = {})
arr = arr.to_a

File.open(file, mode) { |f| f << arr.map(&:to_csv).join("\n") }

  # open(path,mode,opts){ |csv| array.each{ |row| csv << row } }
end

.cvs(_array, _path, mode = 'w', _opts = {}) ⇒ Object



42
43
44
45
46
47
48
# File 'lib/zaphire.rb', line 42

def self.cvs(_array, _path, mode = 'w', _opts = {})
 arr = arr.to_a

 File.open(file, mode) { |f| f << arr.map(&:to_csv).join("\n") }

  # open(path,mode,opts){ |csv| array.each{ |row| csv << row } }
end