Class: Arrow::TableLoader
- Inherits:
-
Object
- Object
- Arrow::TableLoader
- Defined in:
- lib/arrow/table-loader.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(input, options = {}) ⇒ TableLoader
constructor
A new instance of TableLoader.
- #load ⇒ Object
Constructor Details
#initialize(input, options = {}) ⇒ TableLoader
Returns a new instance of TableLoader.
28 29 30 31 32 33 |
# File 'lib/arrow/table-loader.rb', line 28 def initialize(input, ={}) input = input.to_path if input.respond_to?(:to_path) @input = input @options = end |
Class Method Details
.load(input, options = {}) ⇒ Object
23 24 25 |
# File 'lib/arrow/table-loader.rb', line 23 def load(input, ={}) new(input, ).load end |
Instance Method Details
#load ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/arrow/table-loader.rb', line 35 def load if @input.is_a?(URI) custom_load_method = "load_from_uri" elsif @input.is_a?(String) and ::File.directory?(@input) custom_load_method = "load_from_directory" else custom_load_method = "load_from_file" end unless respond_to?(custom_load_method, true) available_schemes = [] (methods(true) | private_methods(true)).each do |name| match_data = /\Aload_from_/.match(name.to_s) if match_data available_schemes << match_data.post_match end end = "Arrow::Table load source must be one of [" << available_schemes.join(", ") << "]: #{@input.inspect}" raise ArgumentError, end __send__(custom_load_method) end |