Module: CSVDecision::Load Private
- Defined in:
- lib/csv_decision/load.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Load all CSV files located in the specified folder.
Class Method Summary collapse
-
.path(path:, options:) ⇒ Hash{Symbol=><CSVDecision::Table>}
private
Load all the CSV files located in the designated folder path.
Class Method Details
.path(path:, options:) ⇒ Hash{Symbol=><CSVDecision::Table>}
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Load all the CSV files located in the designated folder path.
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/csv_decision/load.rb', line 23 def self.path(path:, options:) raise ArgumentError, 'path argument must be a Pathname' unless path.is_a?(Pathname) raise ArgumentError, 'path argument not a valid folder' unless path.directory? tables = {} Dir[path.join('*.csv')].each do |file_name| table_name = File.basename(file_name, '.csv').to_sym tables[table_name] = CSVDecision.parse(Pathname(file_name), ) end tables.freeze end |