Module: Elasticsearch::Model::Adapter

Defined in:
lib/elasticsearch/model/adapter.rb,
lib/elasticsearch/model/adapters/default.rb,
lib/elasticsearch/model/adapters/mongoid.rb,
lib/elasticsearch/model/adapters/multiple.rb,
lib/elasticsearch/model/adapters/active_record.rb

Overview

Contains an adapter which provides OxM-specific implementations for common behaviour:

Defined Under Namespace

Modules: ActiveRecord, Default, Mongoid, Multiple Classes: Adapter

Class Method Summary collapse

Class Method Details

.adaptersObject

Returns registered adapters



52
53
54
# File 'lib/elasticsearch/model/adapter.rb', line 52

def adapters
  Adapter.adapters
end

.from_class(klass) ⇒ Object

Returns an adapter based on the Ruby class passed

Examples:

Create an adapter for an ActiveRecord-based model

class Article < ActiveRecord::Base; end

myadapter = Elasticsearch::Model::Adapter.from_class(Article)
myadapter.adapter
# => Elasticsearch::Model::Adapter::ActiveRecord

See Also:



44
45
46
# File 'lib/elasticsearch/model/adapter.rb', line 44

def from_class(klass)
  Adapter.new(klass)
end

.register(name, condition) ⇒ Object

Registers an adapter



60
61
62
# File 'lib/elasticsearch/model/adapter.rb', line 60

def register(name, condition)
  Adapter.register(name, condition)
end