Sha256: 30db7706f4c94de9b7dc4928c24962ee8019c5db0cc917eba92f5307c711b984
Contents?: true
Size: 517 Bytes
Versions: 12
Compression:
Stored size: 517 Bytes
Contents
# frozen_string_literal: true require "csv" module Spout module Helpers # Reads CSVs and handles conversion of characters into UTF-8 format. class CSVReader def self.read_csv(csv_file) File.open(csv_file, "r:iso-8859-1:utf-8") do |file| csv = CSV.new(file, headers: true, header_converters: ->(h) { h.to_s.downcase }) while line = csv.shift # rubocop:disable Lint/AssignmentInCondition yield line.to_hash end end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems