Module: Elasticsearch::Model::Naming::ClassMethods
- Defined in:
- lib/elasticsearch/model/naming.rb
Instance Method Summary collapse
-
#document_type(name = nil) ⇒ Object
Get or set the document type.
-
#document_type=(name) ⇒ Object
Set the document type.
-
#index_name(name = nil, &block) ⇒ Object
Get or set the name of the index.
-
#index_name=(name) ⇒ Object
Set the index name.
Instance Method Details
#document_type(name = nil) ⇒ Object
Get or set the document type
60 61 62 |
# File 'lib/elasticsearch/model/naming.rb', line 60 def document_type name=nil @document_type = name || @document_type || self.model_name.element end |
#document_type=(name) ⇒ Object
Set the document type
69 70 71 |
# File 'lib/elasticsearch/model/naming.rb', line 69 def document_type=(name) @document_type = name end |
#index_name(name = nil, &block) ⇒ Object
Get or set the name of the index
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/elasticsearch/model/naming.rb', line 29 def index_name name=nil, &block if name || block_given? return (@index_name = name || block) end if @index_name.respond_to?(:call) @index_name.call else @index_name || self.model_name.collection.gsub(/\//, '-') end end |
#index_name=(name) ⇒ Object
Set the index name
44 45 46 |
# File 'lib/elasticsearch/model/naming.rb', line 44 def index_name=(name) @index_name = name end |