Sha256: 5f15cd1df76e781694895a81c2501b5456f9d0a34b2b5120970206ee0da85fed
Contents?: true
Size: 593 Bytes
Versions: 12
Compression:
Stored size: 593 Bytes
Contents
require 'arc-furnace/csv_to_hash_with_duplicate_headers' require 'arc-furnace/enumerator_source' require 'csv' module ArcFurnace class CSVSource < EnumeratorSource include CSVToHashWithDuplicateHeaders attr_reader :value, :file def initialize(filename: , encoding: 'UTF-8') @file = File.open(filename, encoding: encoding) super() end def finalize file.close end def build_enumerator Enumerator.new do |yielder| CSV.new(file, headers: true).each { |row| yielder << csv_to_hash_with_duplicates(row) } end end end end
Version data entries
12 entries across 12 versions & 1 rubygems