Class: Elasticsearch::Rails::HA::IndexStager
- Inherits:
-
IndexStager
- Object
- IndexStager
- Elasticsearch::Rails::HA::IndexStager
- Defined in:
- lib/elasticsearch/rails/ha/index_stager.rb
Instance Attribute Summary collapse
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#live_index_name ⇒ Object
readonly
Returns the value of attribute live_index_name.
Instance Method Summary collapse
-
#initialize(klass) ⇒ IndexStager
constructor
A new instance of IndexStager.
- #stage_index_name ⇒ Object
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
#klass ⇒ Object (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_name ⇒ Object (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_name ⇒ Object
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 |