class RedshiftConnector::DataFile

Public Class Methods

new(reader_class:) click to toggle source
# File lib/redshift_connector/data_file.rb, line 6
def initialize(reader_class:)
  @reader_class = reader_class
end

Public Instance Methods

data_object?() click to toggle source

abstract open

# File lib/redshift_connector/data_file.rb, line 24
def data_object?
  @reader_class.data_object?(key)
end
each_row(&block) click to toggle source
# File lib/redshift_connector/data_file.rb, line 10
def each_row(&block)
  f = open
  begin
    if gzipped_object?
      f = Zlib::GzipReader.new(f)
    end
    @reader_class.new(f).each(&block)
  ensure
    f.close
  end
end
gzipped_object?() click to toggle source
# File lib/redshift_connector/data_file.rb, line 28
def gzipped_object?
  File.extname(key) == '.gz'
end