Class: ElasticMap::Config

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/elastic_map/config.rb

Overview

ElasticMap core configuration.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig


20
21
22
23
# File 'lib/elastic_map/config.rb', line 20

def initialize
  @settings = {}
  @indices_path = 'app/indices'
end

Instance Attribute Details

#indices_pathObject

Returns the value of attribute indices_path


8
9
10
# File 'lib/elastic_map/config.rb', line 8

def indices_path
  @indices_path
end

#loggerObject

Returns the value of attribute logger


8
9
10
# File 'lib/elastic_map/config.rb', line 8

def logger
  @logger
end

#settingsObject

Returns the value of attribute settings


8
9
10
# File 'lib/elastic_map/config.rb', line 8

def settings
  @settings
end

Class Method Details

.delegatedObject


14
15
16
17
18
# File 'lib/elastic_map/config.rb', line 14

def self.delegated
  public_instance_methods -
    superclass.public_instance_methods -
    Singleton.public_instance_methods
end

Instance Method Details

#configurationObject

ElasticMap configurations. There is two ways to set it up: use `ElasticMap.settings=` method or, create `config/elastic_map.yml` file (ERB supported), this file support All Elasticsearch::Client options supports.

test:
  host: 'localhost:9250'

33
34
35
36
37
38
# File 'lib/elastic_map/config.rb', line 33

def configuration
  yaml_settings.merge(settings.deep_symbolize_keys).tap do |configuration|
    configuration[:logger]         = logger if logger
    configuration[:indices_path] ||= indices_path
  end
end