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.
26 27 28 29 30 31 |
# File 'lib/arrow/table-loader.rb', line 26 def initialize(input, ={}) input = input.to_path if input.respond_to?(:to_path) @input = input @options = end |
Class Method Details
.load(input, options = {}) ⇒ Object
21 22 23 |
# File 'lib/arrow/table-loader.rb', line 21 def load(input, ={}) new(input, ).load end |
Instance Method Details
#load ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/arrow/table-loader.rb', line 33 def load format = @options[:format] custom_load_method = "load_as_#{format}" unless respond_to?(custom_load_method, true) available_formats = [] (methods(true) | private_methods(true)).each do |name| match_data = /\Aload_as_/.match(name.to_s) if match_data available_formats << match_data.post_match end end = "Arrow::Table load format must be one of [" << available_formats.join(", ") << "]: #{format.inspect}" raise ArgumentError, end if method(custom_load_method).arity.zero? __send__(custom_load_method) else # For backward compatibility. __send__(custom_load_method, @input) end end |