Class: Elastic::Configuration

Inherits:
Object
  • Object
show all
Includes:
Railties::ConfigurationExtensions
Defined in:
lib/elastic/railtie.rb,
lib/elastic/configuration.rb

Overview

Add activerecord related configuration parameters

Constant Summary collapse

DEFAULTS =
{
  host: '127.0.0.1',
  port: 9200,
  page_size: 20,
  coord_similarity: true,
  import_batch_size: 10_000,
  whiny_indices: false,
  api_client: nil, # set by method
  logger: nil, # set by method
  time_zone: nil, # set by method
  disable_indexing: false,
  disable_index_name_caching: false
}

Instance Attribute Summary collapse

Attributes included from Railties::ConfigurationExtensions

#active_job_queue, #indices_path

Instance Method Summary collapse

Methods included from Railties::ConfigurationExtensions

included

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



20
21
22
# File 'lib/elastic/configuration.rb', line 20

def initialize
  assign_attributes DEFAULTS
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/elastic/configuration.rb', line 17

def api_client
  @api_client
end

#coord_similarityObject

Returns the value of attribute coord_similarity.



17
18
19
# File 'lib/elastic/configuration.rb', line 17

def coord_similarity
  @coord_similarity
end

#disable_index_name_cachingObject

Returns the value of attribute disable_index_name_caching.



17
18
19
# File 'lib/elastic/configuration.rb', line 17

def disable_index_name_caching
  @disable_index_name_caching
end

#disable_indexingObject

Returns the value of attribute disable_indexing.



17
18
19
# File 'lib/elastic/configuration.rb', line 17

def disable_indexing
  @disable_indexing
end

#hostObject

Returns the value of attribute host.



17
18
19
# File 'lib/elastic/configuration.rb', line 17

def host
  @host
end

#import_batch_sizeObject

Returns the value of attribute import_batch_size.



17
18
19
# File 'lib/elastic/configuration.rb', line 17

def import_batch_size
  @import_batch_size
end

#indexObject

Returns the value of attribute index.



17
18
19
# File 'lib/elastic/configuration.rb', line 17

def index
  @index
end

#loggerObject

Returns the value of attribute logger.



17
18
19
# File 'lib/elastic/configuration.rb', line 17

def logger
  @logger
end

#page_sizeObject

Returns the value of attribute page_size.



17
18
19
# File 'lib/elastic/configuration.rb', line 17

def page_size
  @page_size
end

#portObject

Returns the value of attribute port.



17
18
19
# File 'lib/elastic/configuration.rb', line 17

def port
  @port
end

#time_zoneObject

Returns the value of attribute time_zone.



17
18
19
# File 'lib/elastic/configuration.rb', line 17

def time_zone
  @time_zone
end

#whiny_indicesObject

Returns the value of attribute whiny_indices.



17
18
19
# File 'lib/elastic/configuration.rb', line 17

def whiny_indices
  @whiny_indices
end

Instance Method Details

#assign_attributes(_options) ⇒ Object



28
29
30
31
# File 'lib/elastic/configuration.rb', line 28

def assign_attributes(_options)
  _options.each { |k, v| public_send("#{k}=", v) }
  self
end

#resetObject



24
25
26
# File 'lib/elastic/configuration.rb', line 24

def reset
  assign_attributes DEFAULTS
end