for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
# frozen_string_literal: true
require 'csv'
# Helper class to process CSV files
class CsvSource
attr_reader :arrays
attr_reader :file
def initialize(file)
@file = file
end
# returns an array of arrays containing file contents
def read
raise FileNotFoundException.new I18n.t :file_not_found unless File.exist? file
@arrays = CSV.read(file)
# returns a line delimited single string
def to_s
read unless arrays
arrays.map(&:join).join("\n")