Class: MaintenanceTasks::NullCollectionBuilder Private

Inherits:
Object
  • Object
show all
Defined in:
app/models/maintenance_tasks/null_collection_builder.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Base strategy for building a collection-based Task to be performed.

Instance Method Summary collapse

Instance Method Details

#collection(task) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Placeholder method to raise in case a subclass fails to implement the expected instance method.

Raises:

  • (NotImplementedError)

    with a message advising subclasses to implement an override for this method.



13
14
15
# File 'app/models/maintenance_tasks/null_collection_builder.rb', line 13

def collection(task)
  raise NoMethodError, "#{task.class.name} must implement `collection`."
end

#count(task) ⇒ Integer?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Total count of iterations to be performed.

Tasks override this method to define the total amount of iterations expected at the start of the run. Return nil if the amount is undefined, or counting would be prohibitive for your database.

Returns:

  • (Integer, nil)


24
25
26
# File 'app/models/maintenance_tasks/null_collection_builder.rb', line 24

def count(task)
  :no_count
end

#has_csv_content?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return that the Task does not process CSV content.

Returns:

  • (Boolean)


29
30
31
# File 'app/models/maintenance_tasks/null_collection_builder.rb', line 29

def has_csv_content?
  false
end

#no_collection?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns that the Task processes a collection.

Returns:

  • (Boolean)


34
35
36
# File 'app/models/maintenance_tasks/null_collection_builder.rb', line 34

def no_collection?
  false
end