Class: CDMBL::BatchDeleter
- Inherits:
-
Object
- Object
- CDMBL::BatchDeleter
- Defined in:
- lib/cdmbl/batch_deleter.rb
Instance Attribute Summary collapse
-
#batch_size ⇒ Object
readonly
Returns the value of attribute batch_size.
-
#oai_client ⇒ Object
readonly
Returns the value of attribute oai_client.
-
#oai_deletables_klass ⇒ Object
readonly
Returns the value of attribute oai_deletables_klass.
-
#prefix ⇒ Object
readonly
Returns the value of attribute prefix.
-
#solr_client ⇒ Object
readonly
Returns the value of attribute solr_client.
-
#start ⇒ Object
readonly
Returns the value of attribute start.
Instance Method Summary collapse
- #deletables ⇒ Object
- #delete! ⇒ Object
-
#initialize(prefix: '', start: 0, batch_size: 10, oai_client: :missing_oai_client, solr_client: :missing_solr_client, oai_deletables_klass: OaiDeletables) ⇒ BatchDeleter
constructor
A new instance of BatchDeleter.
- #last_batch? ⇒ Boolean
Constructor Details
#initialize(prefix: '', start: 0, batch_size: 10, oai_client: :missing_oai_client, solr_client: :missing_solr_client, oai_deletables_klass: OaiDeletables) ⇒ BatchDeleter
Returns a new instance of BatchDeleter.
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/cdmbl/batch_deleter.rb', line 9 def initialize(prefix: '', start: 0, batch_size: 10, oai_client: :missing_oai_client, solr_client: :missing_solr_client, oai_deletables_klass: OaiDeletables) @prefix = prefix @start = start @batch_size = batch_size @oai_client = oai_client @solr_client = solr_client @oai_deletables_klass = oai_deletables_klass end |
Instance Attribute Details
#batch_size ⇒ Object (readonly)
Returns the value of attribute batch_size.
3 4 5 |
# File 'lib/cdmbl/batch_deleter.rb', line 3 def batch_size @batch_size end |
#oai_client ⇒ Object (readonly)
Returns the value of attribute oai_client.
3 4 5 |
# File 'lib/cdmbl/batch_deleter.rb', line 3 def oai_client @oai_client end |
#oai_deletables_klass ⇒ Object (readonly)
Returns the value of attribute oai_deletables_klass.
3 4 5 |
# File 'lib/cdmbl/batch_deleter.rb', line 3 def oai_deletables_klass @oai_deletables_klass end |
#prefix ⇒ Object (readonly)
Returns the value of attribute prefix.
3 4 5 |
# File 'lib/cdmbl/batch_deleter.rb', line 3 def prefix @prefix end |
#solr_client ⇒ Object (readonly)
Returns the value of attribute solr_client.
3 4 5 |
# File 'lib/cdmbl/batch_deleter.rb', line 3 def solr_client @solr_client end |
#start ⇒ Object (readonly)
Returns the value of attribute start.
3 4 5 |
# File 'lib/cdmbl/batch_deleter.rb', line 3 def start @start end |
Instance Method Details
#deletables ⇒ Object
31 32 33 34 35 |
# File 'lib/cdmbl/batch_deleter.rb', line 31 def deletables @deletables ||= oai_deletables_klass.new(identifiers: ids, oai_client: oai_client, prefix: prefix).deletables end |
#delete! ⇒ Object
23 24 25 |
# File 'lib/cdmbl/batch_deleter.rb', line 23 def delete! solr_client.delete deletables end |
#last_batch? ⇒ Boolean
27 28 29 |
# File 'lib/cdmbl/batch_deleter.rb', line 27 def last_batch? start + batch_size >= num_found end |