Module: Elasticsearch::Persistence::Repository::DSL::ClassMethods

Defined in:
lib/elasticsearch/persistence/repository/dsl.rb

Overview

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

Instance Method Summary collapse

Instance Method Details

#client(_client = nil) ⇒ Class

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

Examples:

MyRepository.client

Returns:

  • (Class)

    _client The repository’s client.

Since:

  • 6.0.0



68
69
70
# File 'lib/elasticsearch/persistence/repository/dsl.rb', line 68

def client(_client = nil)
  @client ||= (_client || Elasticsearch::Client.new)
end

#create_index!(*args) ⇒ Object

Since:

  • 6.0.0



72
73
74
# File 'lib/elasticsearch/persistence/repository/dsl.rb', line 72

def create_index!(*args)
  __raise_not_implemented_error(__method__)
end

#delete_index!(*args) ⇒ Object

Since:

  • 6.0.0



76
77
78
# File 'lib/elasticsearch/persistence/repository/dsl.rb', line 76

def delete_index!(*args)
  __raise_not_implemented_error(__method__)
end

#index_exists?(*args) ⇒ Boolean

Returns:

  • (Boolean)

Since:

  • 6.0.0



84
85
86
# File 'lib/elasticsearch/persistence/repository/dsl.rb', line 84

def index_exists?(*args)
  __raise_not_implemented_error(__method__)
end

#index_name(_name = nil) ⇒ String, Symbol

Get or set the class-level index name setting.

Examples:

MyRepository.index_name

Returns:

  • (String, Symbol)

    _name The repository’s index name.

Since:

  • 6.0.0



44
45
46
# File 'lib/elasticsearch/persistence/repository/dsl.rb', line 44

def index_name(_name = nil)
  @index_name ||= (_name || DEFAULT_INDEX_NAME)
end

#klass(_class = nil) ⇒ Class

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

Examples:

MyRepository.klass

Returns:

  • (Class)

    _class The repository’s klass for deserializing.

Since:

  • 6.0.0



56
57
58
# File 'lib/elasticsearch/persistence/repository/dsl.rb', line 56

def klass(_class = nil)
  instance_variables.include?(:@klass) ? @klass : @klass = _class
end

#refresh_index!(*args) ⇒ Object

Since:

  • 6.0.0



80
81
82
# File 'lib/elasticsearch/persistence/repository/dsl.rb', line 80

def refresh_index!(*args)
  __raise_not_implemented_error(__method__)
end