Sha256: ec7984987de5f1cf6ef47f2035f3bce6b0d934dc8e968361249d49b2a7b10d5d

Contents?: true

Size: 485 Bytes

Versions: 3

Compression:

Stored size: 485 Bytes

Contents

module ExcelUtils
  module Sheets
    class CSV < Base

      def initialize(filename:, **options)
        super(**options)
        @filename = filename
      end

      private

      attr_reader :filename

      def first_row
        NesquikCSV.open(filename) { |csv| csv.readline } || []
      end

      def each_row
        first = true
        NesquikCSV.foreach(filename) do |row|
          yield row unless first
          first = false
        end
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
excel_utils-1.3.1 lib/excel_utils/sheets/csv.rb
excel_utils-1.3.0 lib/excel_utils/sheets/csv.rb
excel_utils-1.2.0 lib/excel_utils/sheets/csv.rb