module Elasticsearch::Rails2::Configuration

Defines constants and methods related to configuration

Constants

DEFAULT_INDEX_NAME

By default, don’t set an index_name

VALID_OPTIONS_KEYS

An array of valid keys in the options hash when configuring Elasticsearch::Rails2

Public Class Methods

extended(base) click to toggle source

When this module is extended, set all configuration options to their default values

# File lib/elasticsearch/rails2/configuration.rb, line 17
def self.extended(base)
  base.reset
end

Public Instance Methods

configure() { |self| ... } click to toggle source

Convenience method to allow configuration options to be set in a block

# File lib/elasticsearch/rails2/configuration.rb, line 22
def configure
  yield self
end
options() click to toggle source

Create a hash of options and their values

# File lib/elasticsearch/rails2/configuration.rb, line 27
def options
  VALID_OPTIONS_KEYS.inject({}) do |option, key|
    option.merge!(key => send(key))
  end
end
reset() click to toggle source

Reset all configuration options to defaults

# File lib/elasticsearch/rails2/configuration.rb, line 34
def reset
  self.index_name     = DEFAULT_INDEX_NAME
end