Class: CDMDEXER::Loader
- Inherits:
-
Object
- Object
- CDMDEXER::Loader
- Defined in:
- lib/cdmdexer/loader.rb
Instance Attribute Summary collapse
-
#deletable_ids ⇒ Object
readonly
Returns the value of attribute deletable_ids.
-
#records ⇒ Object
readonly
Returns the value of attribute records.
-
#solr_client ⇒ Object
readonly
Returns the value of attribute solr_client.
Instance Method Summary collapse
-
#initialize(records: [], deletable_ids: [], solr_client: CDMDEXER::DefaultSolr) ⇒ Loader
constructor
A new instance of Loader.
- #load! ⇒ Object
Constructor Details
#initialize(records: [], deletable_ids: [], solr_client: CDMDEXER::DefaultSolr) ⇒ Loader
Returns a new instance of Loader.
6 7 8 9 10 11 12 |
# File 'lib/cdmdexer/loader.rb', line 6 def initialize(records: [], deletable_ids: [], solr_client: CDMDEXER::DefaultSolr) @solr_client = solr_client @records = records @deletable_ids = deletable_ids end |
Instance Attribute Details
#deletable_ids ⇒ Object (readonly)
Returns the value of attribute deletable_ids.
4 5 6 |
# File 'lib/cdmdexer/loader.rb', line 4 def deletable_ids @deletable_ids end |
#records ⇒ Object (readonly)
Returns the value of attribute records.
4 5 6 |
# File 'lib/cdmdexer/loader.rb', line 4 def records @records end |
#solr_client ⇒ Object (readonly)
Returns the value of attribute solr_client.
4 5 6 |
# File 'lib/cdmdexer/loader.rb', line 4 def solr_client @solr_client end |
Instance Method Details
#load! ⇒ Object
14 15 16 17 |
# File 'lib/cdmdexer/loader.rb', line 14 def load! solr_client.delete deletable_ids unless deletable_ids.empty? solr_client.add records end |