Class: SolrCloud::Configset
- Inherits:
-
Object
- Object
- SolrCloud::Configset
- Defined in:
- lib/solr_cloud/configset.rb
Overview
A configset can’t do much by itself, other than try to delete itself and throw an error if that’s an illegal operation (because a collection is using it)
Instance Attribute Summary collapse
-
#connection ⇒ Connection
readonly
The connection object used to build this configset object.
-
#name ⇒ String
readonly
The name of this configset.
Instance Method Summary collapse
-
#delete! ⇒ Object
Delete this configset.
-
#in_use? ⇒ Boolean
Are there any collections currently using this configset?.
-
#initialize(name:, connection:) ⇒ Configset
constructor
A new instance of Configset.
- #inspect ⇒ Object (also: #to_s)
- #pretty_print(q) ⇒ Object
-
#used_by ⇒ Array<Collection>
(also: #collections)
Which collections use this configset?.
Constructor Details
#initialize(name:, connection:) ⇒ Configset
Returns a new instance of Configset.
16 17 18 19 |
# File 'lib/solr_cloud/configset.rb', line 16 def initialize(name:, connection:) @name = name @connection = connection end |
Instance Attribute Details
#connection ⇒ Connection (readonly)
Returns the connection object used to build this configset object.
14 15 16 |
# File 'lib/solr_cloud/configset.rb', line 14 def connection @connection end |
#name ⇒ String (readonly)
Returns the name of this configset.
11 12 13 |
# File 'lib/solr_cloud/configset.rb', line 11 def name @name end |
Instance Method Details
#delete! ⇒ Object
Delete this configset.
24 25 26 27 |
# File 'lib/solr_cloud/configset.rb', line 24 def delete! connection.delete_configset(name) connection end |
#in_use? ⇒ Boolean
Are there any collections currently using this configset?
39 40 41 |
# File 'lib/solr_cloud/configset.rb', line 39 def in_use? !used_by.empty? end |
#inspect ⇒ Object Also known as: to_s
43 44 45 |
# File 'lib/solr_cloud/configset.rb', line 43 def inspect "<#{self.class.name} '#{name}' at #{connection.url}>" end |
#pretty_print(q) ⇒ Object
49 50 51 |
# File 'lib/solr_cloud/configset.rb', line 49 def pretty_print(q) q.text inspect end |
#used_by ⇒ Array<Collection> Also known as: collections
Which collections use this configset?
31 32 33 |
# File 'lib/solr_cloud/configset.rb', line 31 def used_by connection.only_collections.select { |coll| coll.configset.name == name } end |