Class: Xapit::Client::AbstractModelAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/xapit/client/model_adapters/abstract_model_adapter.rb

Direct Known Subclasses

ActiveRecordAdapter, DefaultModelAdapter

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model_class) ⇒ AbstractModelAdapter

Returns a new instance of AbstractModelAdapter.



25
26
27
# File 'lib/xapit/client/model_adapters/abstract_model_adapter.rb', line 25

def initialize(model_class)
  @model_class = model_class
end

Class Method Details

.adapter_class(model_class) ⇒ Object



9
10
11
# File 'lib/xapit/client/model_adapters/abstract_model_adapter.rb', line 9

def self.adapter_class(model_class)
  @@subclasses.detect { |subclass| subclass.for_class?(model_class) } || DefaultModelAdapter
end

.for_class?(model_class) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/xapit/client/model_adapters/abstract_model_adapter.rb', line 13

def self.for_class?(model_class)
  false # override in subclass
end

.inherited(subclass) ⇒ Object



4
5
6
7
# File 'lib/xapit/client/model_adapters/abstract_model_adapter.rb', line 4

def self.inherited(subclass)
  @@subclasses ||= []
  @@subclasses << subclass
end

Instance Method Details

#index_allObject



21
22
23
# File 'lib/xapit/client/model_adapters/abstract_model_adapter.rb', line 21

def index_all
  # override in subclass
end

#setupObject



17
18
19
# File 'lib/xapit/client/model_adapters/abstract_model_adapter.rb', line 17

def setup
  # override in subclass
end