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, path, options = {}) ⇒ TableSaver
constructor
A new instance of TableSaver.
- #save ⇒ Object
Constructor Details
#initialize(table, path, options = {}) ⇒ TableSaver
Returns a new instance of TableSaver.
26 27 28 29 30 |
# File 'lib/arrow/table-saver.rb', line 26 def initialize(table, path, ={}) @table = table @path = path @options = end |
Class Method Details
.save(table, path, options = {}) ⇒ Object
21 22 23 |
# File 'lib/arrow/table-saver.rb', line 21 def save(table, path, ={}) new(table, path, ).save end |
Instance Method Details
#save ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/arrow/table-saver.rb', line 32 def save path = @path path = path.to_path if path.respond_to?(:to_path) format = @options[:format] || guess_format(path) || :arrow custom_save_method = "save_as_#{format}" unless respond_to?(custom_save_method, true) available_formats = [] (methods(true) | private_methods(true)).each do |name| match_data = /\Asave_as_/.match(name.to_s) if match_data available_formats << match_data.post_match end end = "Arrow::Table save format must be one of [" << available_formats.join(", ") << "]: #{format.inspect}" raise ArgumentError, end __send__(custom_save_method, path) end |