Class: Arrow::TableSaver
- Inherits:
-
Object
- Object
- Arrow::TableSaver
- Defined in:
- lib/arrow/table-saver.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(table, output, options = {}) ⇒ TableSaver
constructor
A new instance of TableSaver.
- #save ⇒ Object
Constructor Details
#initialize(table, output, options = {}) ⇒ TableSaver
Returns a new instance of TableSaver.
26 27 28 29 30 31 32 |
# File 'lib/arrow/table-saver.rb', line 26 def initialize(table, output, ={}) @table = table output = output.to_path if output.respond_to?(:to_path) @output = output @options = end |
Class Method Details
.save(table, output, options = {}) ⇒ Object
21 22 23 |
# File 'lib/arrow/table-saver.rb', line 21 def save(table, output, ={}) new(table, output, ).save end |
Instance Method Details
#save ⇒ Object
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-saver.rb', line 34 def save if @output.is_a?(URI) custom_save_method = "save_to_uri" else custom_save_method = "save_to_file" end unless respond_to?(custom_save_method, true) available_schemes = [] (methods(true) | private_methods(true)).each do |name| match_data = /\Asave_to_/.match(name.to_s) if match_data available_schemes << match_data.post_match end end = "Arrow::Table save source must be one of [" << available_schemes.join(", ") << "]: #{@output.scheme.inspect}" raise ArgumentError, end __send__(custom_save_method) @table end |