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.
Instance Method Summary collapse
-
#client(_client = nil) ⇒ Class
Get or set the class-level setting for the client used by the repository.
- #create_index!(*args) ⇒ Object
- #delete_index!(*args) ⇒ Object
- #index_exists?(*args) ⇒ Boolean
-
#index_name(_name = nil) ⇒ String, Symbol
Get or set the class-level index name setting.
-
#klass(_class = nil) ⇒ Class
Get or set the class-level setting for the class used by the repository when deserializing.
- #refresh_index!(*args) ⇒ Object
Instance Method Details
#client(_client = nil) ⇒ Class
Get or set the class-level setting for the client used by the repository.
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
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
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
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.
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.
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
80 81 82 |
# File 'lib/elasticsearch/persistence/repository/dsl.rb', line 80 def refresh_index!(*args) __raise_not_implemented_error(__method__) end |