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
def initialize(file, options)
@file = file
@options = options
end
def each
CSV.foreach(@file, @options) do |row|
yield row.to_hash
# returns an array of arrays containing file contents
def read
@arrays = CSV.read(@file)
# returns a line delimited single string
def to_s
read unless @arrays
@arrays.map(&:join).join("\n")