Class: RedshiftConnector::Reader::CSV

Inherits:
Abstract
  • Object
show all
Defined in:
lib/redshift_connector/reader/csv.rb

Overview

Parses (standard) CSV files. For UNLOAD-generated CSV, use RedshiftCSV class.

Constant Summary

Constants inherited from Abstract

Abstract::READER_CLASSES

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Abstract

declare_reader, get_reader_class

Constructor Details

#initialize(f) ⇒ CSV

Returns a new instance of CSV.



15
16
17
# File 'lib/redshift_connector/reader/csv.rb', line 15

def initialize(f)
  @f = f
end

Class Method Details

.data_object?(key) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/redshift_connector/reader/csv.rb', line 11

def self.data_object?(key)
  /\.csv(?:\.|\z)/ =~ File.basename(key)
end

Instance Method Details

#each(&block) ⇒ Object



19
20
21
22
# File 'lib/redshift_connector/reader/csv.rb', line 19

def each(&block)
  csv = CSV.new(@f)
  csv.each(&block)
end