Class: Kithe::IndexableSettings

Inherits:
Object
  • Object
show all
Defined in:
lib/kithe/indexable_settings.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(solr_url:, writer_class_name:, writer_settings:, model_name_solr_field:, solr_id_value_attribute:, disable_callbacks: false, batching_mode_batch_size: 100) ⇒ IndexableSettings

Returns a new instance of IndexableSettings.



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/kithe/indexable_settings.rb', line 6

def initialize(solr_url:, writer_class_name:, writer_settings:,
               model_name_solr_field:, solr_id_value_attribute:, disable_callbacks: false,
               batching_mode_batch_size: 100)
  @writer_class_name = writer_class_name
  @writer_settings = writer_settings
  @model_name_solr_field = model_name_solr_field
  @solr_id_value_attribute = solr_id_value_attribute || 'id'
  @batching_mode_batch_size = batching_mode_batch_size

  # use our local setter to set solr_url also in writer_settings
  solr_url = solr_url
end

Instance Attribute Details

#batching_mode_batch_sizeObject

Returns the value of attribute batching_mode_batch_size.



3
4
5
# File 'lib/kithe/indexable_settings.rb', line 3

def batching_mode_batch_size
  @batching_mode_batch_size
end

#disable_callbacksObject

Returns the value of attribute disable_callbacks.



3
4
5
# File 'lib/kithe/indexable_settings.rb', line 3

def disable_callbacks
  @disable_callbacks
end

#model_name_solr_fieldObject

Returns the value of attribute model_name_solr_field.



3
4
5
# File 'lib/kithe/indexable_settings.rb', line 3

def model_name_solr_field
  @model_name_solr_field
end

#solr_id_value_attributeObject

Returns the value of attribute solr_id_value_attribute.



3
4
5
# File 'lib/kithe/indexable_settings.rb', line 3

def solr_id_value_attribute
  @solr_id_value_attribute
end

#solr_urlObject

Returns the value of attribute solr_url.



3
4
5
# File 'lib/kithe/indexable_settings.rb', line 3

def solr_url
  @solr_url
end

#writer_class_nameObject

Returns the value of attribute writer_class_name.



3
4
5
# File 'lib/kithe/indexable_settings.rb', line 3

def writer_class_name
  @writer_class_name
end

#writer_settingsObject

Returns the value of attribute writer_settings.



3
4
5
# File 'lib/kithe/indexable_settings.rb', line 3

def writer_settings
  @writer_settings
end

Instance Method Details

#writer_classObject

Turn writer_class_name into an actual Class object.



27
28
29
# File 'lib/kithe/indexable_settings.rb', line 27

def writer_class
  writer_class_name.constantize
end

#writer_instance!(additional_settings = {}) ⇒ Object

Instantiate a new writer based on ‘writer_class_name` and `writer_settings`



32
33
34
# File 'lib/kithe/indexable_settings.rb', line 32

def writer_instance!(additional_settings = {})
  writer_class.new(writer_settings.merge(additional_settings))
end