Class: Elasticsearch::Rails::HA::IndexStager

Inherits:
IndexStager
  • Object
show all
Defined in:
lib/elasticsearch/rails/ha/index_stager.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass) ⇒ IndexStager

Returns a new instance of IndexStager.



9
10
11
12
13
# File 'lib/elasticsearch/rails/ha/index_stager.rb', line 9

def initialize(klass)
  @klass = klass.constantize
  @index_name = @klass.index_name
  @es_client = @klass.__elasticsearch__.client
end

Instance Attribute Details

#klassObject (readonly)

Returns the value of attribute klass.



7
8
9
# File 'lib/elasticsearch/rails/ha/index_stager.rb', line 7

def klass
  @klass
end

#live_index_nameObject (readonly)

Returns the value of attribute live_index_name.



7
8
9
# File 'lib/elasticsearch/rails/ha/index_stager.rb', line 7

def live_index_name
  @live_index_name
end

Instance Method Details

#stage_index_nameObject



15
16
17
18
19
20
21
# File 'lib/elasticsearch/rails/ha/index_stager.rb', line 15

def stage_index_name
  if klass.respond_to?(:stage_index_name)
    klass.stage_index_name
  else
    index_name + "_staged"
  end
end