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) ⇒ IndexableSettings

Returns a new instance of IndexableSettings.



5
6
7
8
9
10
11
12
# File 'lib/kithe/indexable_settings.rb', line 5

def initialize(solr_url:, writer_class_name:, writer_settings:,
               model_name_solr_field:, solr_id_value_attribute:, disable_callbacks: false)
  @solr_url = solr_url
  @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
end

Instance Attribute Details

#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

Use configured solr_url, and merge together with configured writer_settings



16
17
18
# File 'lib/kithe/indexable_settings.rb', line 16

def writer_settings
  @writer_settings
end

Instance Method Details

#writer_classObject

Turn writer_class_name into an actual Class object.



25
26
27
# File 'lib/kithe/indexable_settings.rb', line 25

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`



30
31
32
# File 'lib/kithe/indexable_settings.rb', line 30

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