Sha256: a387cbddbc73b53ed12b6c1f88be3319bebb27ccc00bd71c46c22fd5808cf520

Contents?: true

Size: 715 Bytes

Versions: 29

Compression:

Stored size: 715 Bytes

Contents

require 'csv'

module Eco
  class CSV < ::CSV

    class << self

      # @return [Eco::CSV::Table]
      def parse(data, **kargs, &block)
        kargs = {headers: true, skip_blanks: true}.merge(kargs)
        Eco::CSV::Table.new(super(data, **kargs, &block))
      end

      # @return [Eco::CSV::Table]
      def read(file, **kargs)
        kargs = {headers: true,  skip_blanks: true}.merge(kargs)
        args = [file].tap do |arg|
          encoding = Eco::API::Common::Session::FileManager.encoding(file)
          arg.push("rb:bom|utf-8") if encoding == "bom"
        end
        Eco::CSV::Table.new(super(*args, **kargs))
      end
    end
  end
end

require_relative 'csv/table'

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
eco-helpers-2.4.9 lib/eco/csv.rb
eco-helpers-2.4.8 lib/eco/csv.rb
eco-helpers-2.4.7 lib/eco/csv.rb
eco-helpers-2.4.6 lib/eco/csv.rb
eco-helpers-2.4.5 lib/eco/csv.rb
eco-helpers-2.4.4 lib/eco/csv.rb
eco-helpers-2.4.3 lib/eco/csv.rb
eco-helpers-2.4.2 lib/eco/csv.rb
eco-helpers-2.3.3 lib/eco/csv.rb
eco-helpers-2.3.2 lib/eco/csv.rb
eco-helpers-2.2.5 lib/eco/csv.rb
eco-helpers-2.2.4 lib/eco/csv.rb
eco-helpers-2.2.3 lib/eco/csv.rb
eco-helpers-2.2.2 lib/eco/csv.rb
eco-helpers-2.2.1 lib/eco/csv.rb
eco-helpers-2.1.12 lib/eco/csv.rb
eco-helpers-2.1.11 lib/eco/csv.rb
eco-helpers-2.1.10 lib/eco/csv.rb
eco-helpers-2.1.9 lib/eco/csv.rb
eco-helpers-2.1.8 lib/eco/csv.rb