Class: Samvera::NestingIndexer::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/samvera/nesting_indexer/configuration.rb

Overview

Responsible for the configuration of the Samvera::NestingIndexer

Constant Summary collapse

DEFAULT_MAXIMUM_NESTING_DEPTH =
15

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(maximum_nesting_depth: DEFAULT_MAXIMUM_NESTING_DEPTH, logger: default_logger) ⇒ Configuration

Returns a new instance of Configuration.



12
13
14
15
# File 'lib/samvera/nesting_indexer/configuration.rb', line 12

def initialize(maximum_nesting_depth: DEFAULT_MAXIMUM_NESTING_DEPTH, logger: default_logger)
  self.maximum_nesting_depth = maximum_nesting_depth
  self.logger = logger
end

Instance Attribute Details

#loggerObject



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

def logger
  @logger
end

#maximum_nesting_depthObject



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

def maximum_nesting_depth
  @maximum_nesting_depth
end

Instance Method Details

#adapterObject

Returns Samvera::NestingIndexer::Adapters::AbstractAdapter.

Returns:

  • Samvera::NestingIndexer::Adapters::AbstractAdapter



59
60
61
# File 'lib/samvera/nesting_indexer/configuration.rb', line 59

def adapter
  @adapter || default_adapter
end

#adapter=(object) ⇒ Object

Raises:

  • AdapterConfigurationError if the given adapter does not implement the correct interface



64
65
66
67
68
69
70
# File 'lib/samvera/nesting_indexer/configuration.rb', line 64

def adapter=(object)
  object_methods = object.methods
  adapter_methods = Adapters::AbstractAdapter.methods(false)
  # Making sure that the adapter methods are all available in the object_methods
  raise Exceptions::AdapterConfigurationError.new(object, adapter_methods) unless adapter_methods & object_methods == adapter_methods
  @adapter = object
end

#solr_field_name_for_deepest_nested_depthObject



53
54
55
# File 'lib/samvera/nesting_indexer/configuration.rb', line 53

def solr_field_name_for_deepest_nested_depth
  @solr_field_name_for_deepest_nested_depth || raise(Exceptions::SolrKeyConfigurationError.new(name: __method__, config: self))
end

#solr_field_name_for_deepest_nested_depth=(input) ⇒ Object



49
50
51
# File 'lib/samvera/nesting_indexer/configuration.rb', line 49

def solr_field_name_for_deepest_nested_depth=(input)
  @solr_field_name_for_deepest_nested_depth = input.to_s
end

#solr_field_name_for_storing_ancestorsObject



37
38
39
# File 'lib/samvera/nesting_indexer/configuration.rb', line 37

def solr_field_name_for_storing_ancestors
  @solr_field_name_for_storing_ancestors || raise(Exceptions::SolrKeyConfigurationError.new(name: __method__, config: self))
end

#solr_field_name_for_storing_ancestors=(input) ⇒ Object



33
34
35
# File 'lib/samvera/nesting_indexer/configuration.rb', line 33

def solr_field_name_for_storing_ancestors=(input)
  @solr_field_name_for_storing_ancestors = input.to_s
end

#solr_field_name_for_storing_parent_idsObject



29
30
31
# File 'lib/samvera/nesting_indexer/configuration.rb', line 29

def solr_field_name_for_storing_parent_ids
  @solr_field_name_for_storing_parent_ids || raise(Exceptions::SolrKeyConfigurationError.new(name: __method__, config: self))
end

#solr_field_name_for_storing_parent_ids=(input) ⇒ Object



25
26
27
# File 'lib/samvera/nesting_indexer/configuration.rb', line 25

def solr_field_name_for_storing_parent_ids=(input)
  @solr_field_name_for_storing_parent_ids = input.to_s
end

#solr_field_name_for_storing_pathnamesObject



45
46
47
# File 'lib/samvera/nesting_indexer/configuration.rb', line 45

def solr_field_name_for_storing_pathnames
  @solr_field_name_for_storing_pathnames || raise(Exceptions::SolrKeyConfigurationError.new(name: __method__, config: self))
end

#solr_field_name_for_storing_pathnames=(input) ⇒ Object



41
42
43
# File 'lib/samvera/nesting_indexer/configuration.rb', line 41

def solr_field_name_for_storing_pathnames=(input)
  @solr_field_name_for_storing_pathnames = input.to_s
end