Class: Solr::CoreConfiguration::CoreConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/solr/core_configuration/core_config.rb

Direct Known Subclasses

EnvUrlCoreConfig

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, fields:, default:) ⇒ CoreConfig

Returns a new instance of CoreConfig.



6
7
8
9
10
# File 'lib/solr/core_configuration/core_config.rb', line 6

def initialize(name:, fields:, default:)
  @name = name
  @fields = fields
  @default = default
end

Instance Attribute Details

#fieldsObject (readonly)

Returns the value of attribute fields.



4
5
6
# File 'lib/solr/core_configuration/core_config.rb', line 4

def fields
  @fields
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/solr/core_configuration/core_config.rb', line 4

def name
  @name
end

Instance Method Details

#default?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/solr/core_configuration/core_config.rb', line 16

def default?
  @default
end

#field_by_name(field_name) ⇒ Object



12
13
14
# File 'lib/solr/core_configuration/core_config.rb', line 12

def field_by_name(field_name)
  fields[field_name.to_sym]
end

#uriObject



24
25
26
# File 'lib/solr/core_configuration/core_config.rb', line 24

def uri
  @uri ||= Addressable::URI.parse(url)
end

#urlObject



20
21
22
# File 'lib/solr/core_configuration/core_config.rb', line 20

def url
  @url ||= File.join(Solr.configuration.url || ENV['SOLR_URL'], name.to_s).chomp('/')
end