module Elasticsearch::Persistence::Repository::DSL::ClassMethods

These methods are necessary to define at the class-level so that the methods available via Elasticsearch::Model::Indexing::ClassMethods have the references they depend on.

@since 6.0.0

Public Instance Methods

client(_client = nil) click to toggle source

Get or set the class-level setting for the client used by the repository.

@example

MyRepository.client

@return [ Class ] _client The repository’s client.

@since 6.0.0

# File lib/elasticsearch/persistence/repository/dsl.rb, line 68
def client(_client = nil)
  @client ||= (_client || Elasticsearch::Client.new)
end
create_index!(*args) click to toggle source
# File lib/elasticsearch/persistence/repository/dsl.rb, line 72
def create_index!(*args)
  __raise_not_implemented_error(__method__)
end
delete_index!(*args) click to toggle source
# File lib/elasticsearch/persistence/repository/dsl.rb, line 76
def delete_index!(*args)
  __raise_not_implemented_error(__method__)
end
index_exists?(*args) click to toggle source
# File lib/elasticsearch/persistence/repository/dsl.rb, line 84
def index_exists?(*args)
  __raise_not_implemented_error(__method__)
end
index_name(_name = nil) click to toggle source

Get or set the class-level index name setting.

@example

MyRepository.index_name

@return [ String, Symbol ] _name The repository’s index name.

@since 6.0.0

# File lib/elasticsearch/persistence/repository/dsl.rb, line 44
def index_name(_name = nil)
  @index_name ||= (_name || DEFAULT_INDEX_NAME)
end
klass(_class = nil) click to toggle source

Get or set the class-level setting for the class used by the repository when deserializing.

@example

MyRepository.klass

@return [ Class ] _class The repository’s klass for deserializing.

@since 6.0.0

# File lib/elasticsearch/persistence/repository/dsl.rb, line 56
def klass(_class = nil)
  instance_variables.include?(:@klass) ? @klass : @klass = _class
end
refresh_index!(*args) click to toggle source
# File lib/elasticsearch/persistence/repository/dsl.rb, line 80
def refresh_index!(*args)
  __raise_not_implemented_error(__method__)
end

Private Instance Methods

__raise_not_implemented_error(_method_) click to toggle source
# File lib/elasticsearch/persistence/repository/dsl.rb, line 90
def __raise_not_implemented_error(_method_)
  raise NotImplementedError, "The '#{_method_}' method is not implemented on the Repository class."
end