module LatexCurriculumVitae::CVOutfile
Module for creating and appending the outfile
Public Class Methods
add_to_outfile(job_title, company, contact, email_address, csv_out, job_url_checked)
click to toggle source
Method to adding the data into the csv file @param [String] job_title Title of the job application @param [String] company Companyname for the application @param [String] contact Name of the Contact in the Company @param [String] email_address Emailaddress of the Contact @param [String] csv_out Name of the CSV-Outfile @param [String] job_url_checked The shortened URL TODO: Try to fix this in future rubocop:disable Metrics/AbcSize This method smells of :reek:LongParameterList
# File lib/latex_curriculum_vitae/outfile.rb, line 33 def self.add_to_outfile(job_title, company, contact, email_address, csv_out, job_url_checked) time = Time.new date = time.strftime('%Y-%m-%d') contact.gsub!('%20', ' ') job_title.gsub!('%20', ' ') job_title.gsub!('%26', '&') if File.exist?(csv_out) puts 'do nothing' else FileUtils.touch(csv_out) # rubocop:disable IndentHeredoc File.write csv_out.to_s, <<CSV date,company,job,contact,email,status, joburl CSV end CSV.open(csv_out.to_s, 'a+') do |csv| # datum,firma,stelle,kontakt,email,status,joburl csv << [date.to_s, company.to_s, job_title.to_s, contact.to_s, email_address.to_s, 'Open', job_url_checked.to_s] end end