Class: Arrow::CSVLoader
- Inherits:
-
Object
- Object
- Arrow::CSVLoader
- Defined in:
- lib/arrow/csv-loader.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(path_or_data, **options) ⇒ CSVLoader
constructor
A new instance of CSVLoader.
- #load ⇒ Object
Constructor Details
#initialize(path_or_data, **options) ⇒ CSVLoader
Returns a new instance of CSVLoader.
30 31 32 33 34 35 36 37 |
# File 'lib/arrow/csv-loader.rb', line 30 def initialize(path_or_data, **) @path_or_data = path_or_data @options = if @options.key?(:delimiter) @options[:col_sep] = @options.delete(:delimiter) end @compression = @options.delete(:compression) end |
Class Method Details
.load(path_or_data, **options) ⇒ Object
25 26 27 |
# File 'lib/arrow/csv-loader.rb', line 25 def load(path_or_data, **) new(path_or_data, **).load end |
Instance Method Details
#load ⇒ Object
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/arrow/csv-loader.rb', line 39 def load case @path_or_data when Pathname load_from_path(@path_or_data.to_path) when /\A.+\.csv\z/i load_from_path(@path_or_data) else load_data(@path_or_data) end end |