class Template::Csv
handles creating and writing CSV output files
Attributes
file_name[R]
Public Class Methods
new(dir, attr_labels)
click to toggle source
dir: basename of root directory attr_labels: array of attributes labels as strings
# File lib/template.rb, line 15 def initialize(dir, attr_labels) @file_name = "tmp/output/#{dir}_#{Time.now.to_i}.csv" @file = File.new(@file_name, 'w') @file.puts(attr_labels.join(',')) end
Public Instance Methods
close()
click to toggle source
# File lib/template.rb, line 26 def close @file.close end
insert(img_attrs)
click to toggle source
Writes data row to file
# File lib/template.rb, line 22 def insert(img_attrs) @file.puts(img_attrs.join(',')) end