class Elasticsearch::Model::Registry

Keeps a global registry of classes that include `Elasticsearch::Model`

Public Class Methods

__instance() click to toggle source

Returns the unique instance of the registry (Singleton)

@api private

# File lib/elasticsearch/model/multimodel.rb, line 32
def self.__instance
  @instance ||= new
end
add(klass) click to toggle source

Adds a model to the registry

# File lib/elasticsearch/model/multimodel.rb, line 38
def self.add(klass)
  __instance.add(klass)
end
all() click to toggle source

Returns an Array of registered models

# File lib/elasticsearch/model/multimodel.rb, line 44
def self.all
  __instance.models
end
new() click to toggle source
# File lib/elasticsearch/model/multimodel.rb, line 24
def initialize
  @models = []
end

Public Instance Methods

add(klass) click to toggle source

Adds a model to the registry

# File lib/elasticsearch/model/multimodel.rb, line 50
def add(klass)
  @models << klass
end
models() click to toggle source

Returns a copy of the registered models

# File lib/elasticsearch/model/multimodel.rb, line 56
def models
  @models.dup
end