Class: Impex::FileLoader::FileSystem
- Defined in:
- lib/impex/file_loaders/file_system.rb
Instance Method Summary collapse
-
#load ⇒ Object
The method #load is responsible to fetch all files (instances of Impex::File).
Methods inherited from Base
Constructor Details
This class inherits a constructor from Impex::FileLoader::Base
Instance Method Details
#load ⇒ Object
The method #load is responsible to fetch all files (instances of Impex::File). Each rows are stored as an array of Impex::Row. The routine CSVImport::FileFormatter.build takes an instance of File as parameter and returns an instance of Impex::File which contains a set of Impex::Row accessible via :each method
13 14 15 16 17 18 19 |
# File 'lib/impex/file_loaders/file_system.rb', line 13 def load files = [] ::Dir.glob("#{::Rails.root}/#{@options[:relative_path]}/csv_import/**/*.csv").each do |f| files << Impex::FileFormatter.build(::File.open(f)) end files end |