Sha256: 8aaeceb2058471b35ec896ff99b3c9cfc734ee7cfd296504b447a506b3dacac0

Contents?: true

Size: 403 Bytes

Versions: 3

Compression:

Stored size: 403 Bytes

Contents

require 'csv'

module Squib
  # @api private
  module Args
    class CSV_Opts

      def initialize(opts)
        opts = opts.keep_if { |k, _v| CSV::DEFAULT_OPTIONS.key? k}
        @hash = CSV::DEFAULT_OPTIONS.merge(opts).merge(required)
      end

      def to_hash
        @hash
      end

      private

      def required
        { headers: true, converters: :numeric }
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
squib-0.15.2 lib/squib/args/csv_opts.rb
squib-0.15.1 lib/squib/args/csv_opts.rb
squib-0.14.2 lib/squib/args/csv_opts.rb