Class: Chronicle::ETL::FileExtractor

Inherits:
Extractor
  • Object
show all
Defined in:
lib/chronicle/etl/extractors/file_extractor.rb

Overview

Return filenames that match a pattern in a directory

Instance Attribute Summary

Attributes included from Registry::SelfRegistering

#connector_registration

Instance Method Summary collapse

Methods inherited from Extractor

#initialize

Methods included from Registry::SelfRegistering

#register_connector

Methods included from Configurable

included

Constructor Details

This class inherits a constructor from Chronicle::ETL::Extractor

Instance Method Details

#extractObject



23
24
25
26
27
# File 'lib/chronicle/etl/extractors/file_extractor.rb', line 23

def extract
  @pathnames.each do |pathname|
    yield Chronicle::ETL::Extraction.new(data: pathname.to_path)
  end
end

#prepareObject



19
20
21
# File 'lib/chronicle/etl/extractors/file_extractor.rb', line 19

def prepare
  @pathnames = gather_files
end

#results_countObject



29
30
31
# File 'lib/chronicle/etl/extractors/file_extractor.rb', line 29

def results_count
  @pathnames.count
end