Module: Charty::VectorAdapters

Defined in:
lib/charty/vector_adapters.rb,
lib/charty/vector_adapters/daru_adapter.rb,
lib/charty/vector_adapters/array_adapter.rb,
lib/charty/vector_adapters/arrow_adapter.rb,
lib/charty/vector_adapters/numpy_adapter.rb,
lib/charty/vector_adapters/narray_adapter.rb,
lib/charty/vector_adapters/pandas_adapter.rb,
lib/charty/vector_adapters/vector_adapter.rb,
lib/charty/vector_adapters/nmatrix_adapter.rb

Defined Under Namespace

Modules: IndexSupport, NameSupport Classes: ArrayAdapter, ArrowAdapter, BaseAdapter, DaruVectorAdapter, NArrayAdapter, NMatrixAdapter, NumpyAdapter, PandasSeriesAdapter, UnsupportedVectorData, VectorAdapter

Class Method Summary collapse

Class Method Details

.find_adapter_class(data, exception: true) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/charty/vector_adapters.rb', line 13

def self.find_adapter_class(data, exception: true)
  @adapters.each_value do |adapter_class|
    return adapter_class if adapter_class.supported?(data)
  end
  if exception
    raise UnsupportedVectorData, "Unsupported vector data (#{data.class})"
  end
end

.register(name, adapter_class) ⇒ Object



9
10
11
# File 'lib/charty/vector_adapters.rb', line 9

def self.register(name, adapter_class)
  @adapters[name] = adapter_class
end