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
-
#document_type(_type = nil) ⇒ String, Symbol
Get or set the class-level document type setting.
- #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.
82 83 84 |
# File 'lib/elasticsearch/persistence/repository/dsl.rb', line 82 def client(_client = nil) @client ||= (_client || Elasticsearch::Client.new) end |
#create_index!(*args) ⇒ Object
86 87 88 |
# File 'lib/elasticsearch/persistence/repository/dsl.rb', line 86 def create_index!(*args) __raise_not_implemented_error(__method__) end |
#delete_index!(*args) ⇒ Object
90 91 92 |
# File 'lib/elasticsearch/persistence/repository/dsl.rb', line 90 def delete_index!(*args) __raise_not_implemented_error(__method__) end |
#document_type(_type = nil) ⇒ String, Symbol
Get or set the class-level document type setting.
46 47 48 |
# File 'lib/elasticsearch/persistence/repository/dsl.rb', line 46 def document_type(_type = nil) @document_type ||= _type end |
#index_exists?(*args) ⇒ Boolean
98 99 100 |
# File 'lib/elasticsearch/persistence/repository/dsl.rb', line 98 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.
58 59 60 |
# File 'lib/elasticsearch/persistence/repository/dsl.rb', line 58 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.
70 71 72 |
# File 'lib/elasticsearch/persistence/repository/dsl.rb', line 70 def klass(_class = nil) instance_variables.include?(:@klass) ? @klass : @klass = _class end |
#refresh_index!(*args) ⇒ Object
94 95 96 |
# File 'lib/elasticsearch/persistence/repository/dsl.rb', line 94 def refresh_index!(*args) __raise_not_implemented_error(__method__) end |