class Vcsmap::CsvWriter
Public Class Methods
new(plugin_name, plugin_header, data)
click to toggle source
# File lib/vcsmap/csv_writer.rb, line 5 def initialize(plugin_name, plugin_header, data) @file_path = file_path(plugin_name) @header = header(plugin_header) @data = data end
Public Instance Methods
write!()
click to toggle source
# File lib/vcsmap/csv_writer.rb, line 11 def write! puts "Writing CSV to #{@file_path} ..." CSV.open(@file_path, 'wb', force_quotes: true) do |csv| csv << @header @data.each do |line| csv << line end end end
Private Instance Methods
file_path(plugin_name)
click to toggle source
# File lib/vcsmap/csv_writer.rb, line 27 def file_path(plugin_name) folder + "#{DateTime.now.strftime('%Y%m%dT%H%M')}-#{plugin_name}.csv" end
folder()
click to toggle source
# File lib/vcsmap/csv_writer.rb, line 23 def folder "#{Dir.pwd}/" end
header(plugin_header)
click to toggle source
# File lib/vcsmap/csv_writer.rb, line 31 def header(plugin_header) plugin_header << 'Repo' end