Module: Elasticsearch::Rails2::Configuration
- Included in:
- Elasticsearch::Rails2
- Defined in:
- lib/elasticsearch/rails2/configuration.rb
Overview
Defines constants and methods related to configuration
Constant Summary collapse
- VALID_OPTIONS_KEYS =
An array of valid keys in the options hash when configuring Elasticsearch::Rails2
[ :index_name ].freeze
- DEFAULT_INDEX_NAME =
By default, don’t set an index_name
nil
Class Method Summary collapse
-
.extended(base) ⇒ Object
When this module is extended, set all configuration options to their default values.
Instance Method Summary collapse
-
#configure {|_self| ... } ⇒ Object
Convenience method to allow configuration options to be set in a block.
-
#options ⇒ Object
Create a hash of options and their values.
-
#reset ⇒ Object
Reset all configuration options to defaults.
Class Method Details
.extended(base) ⇒ Object
When this module is extended, set all configuration options to their default values
17 18 19 |
# File 'lib/elasticsearch/rails2/configuration.rb', line 17 def self.extended(base) base.reset end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
Convenience method to allow configuration options to be set in a block
22 23 24 |
# File 'lib/elasticsearch/rails2/configuration.rb', line 22 def configure yield self end |
#options ⇒ Object
Create a hash of options and their values
27 28 29 30 31 |
# File 'lib/elasticsearch/rails2/configuration.rb', line 27 def VALID_OPTIONS_KEYS.inject({}) do |option, key| option.merge!(key => send(key)) end end |
#reset ⇒ Object
Reset all configuration options to defaults
34 35 36 |
# File 'lib/elasticsearch/rails2/configuration.rb', line 34 def reset self.index_name = DEFAULT_INDEX_NAME end |