Sha256: d179c78a2bb64c86c3674b32684495f135f14a32c120462db63375f9bed3101f
Contents?: true
Size: 1.07 KB
Versions: 25
Compression:
Stored size: 1.07 KB
Contents
require_relative 'convertible/heading' require_relative 'convertible/parsing' require_relative 'convertible/inputable' module Eco::API::UseCases::GraphQL::Samples::Location::Service module TreeDiff # Offers a way to convert the values and keys/headers # of the input csv file/rows module Convertible class << self def included(base) super(base) base.send :include, Inputable end end include Parsing include Heading private def input_csv @input_csv ||= Eco::CSV.read(input_file, encoding: input_encoding).then do |csv| next csv unless header_maps&.any? csv.transform_headers do |name| next name unless header_maps.key?(name) header_maps[name] end end.then do |csv| transform_input_csv(csv).tap do |res| next if res.is_a?(Eco::CSV::Table) raise ArgumentError, "Expecting and Eco::CSV::Table. Given: #{res.class}" end end end end end end
Version data entries
25 entries across 25 versions & 1 rubygems