Class: CanvasSync::JobUniqueness::OnConflict::Base
- Inherits:
-
Object
- Object
- CanvasSync::JobUniqueness::OnConflict::Base
- Defined in:
- lib/canvas_sync/job_uniqueness/on_conflict/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#lock_context ⇒ Object
readonly
Returns the value of attribute lock_context.
-
#redis_pool ⇒ Object
readonly
Returns the value of attribute redis_pool.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(lock_context, redis_pool = nil) ⇒ Base
constructor
A new instance of Base.
- #replace? ⇒ Boolean
Constructor Details
#initialize(lock_context, redis_pool = nil) ⇒ Base
Returns a new instance of Base.
18 19 20 21 |
# File 'lib/canvas_sync/job_uniqueness/on_conflict/base.rb', line 18 def initialize(lock_context, redis_pool = nil) @lock_context = lock_context @redis_pool = redis_pool end |
Instance Attribute Details
#lock_context ⇒ Object (readonly)
Returns the value of attribute lock_context.
4 5 6 |
# File 'lib/canvas_sync/job_uniqueness/on_conflict/base.rb', line 4 def lock_context @lock_context end |
#redis_pool ⇒ Object (readonly)
Returns the value of attribute redis_pool.
5 6 7 |
# File 'lib/canvas_sync/job_uniqueness/on_conflict/base.rb', line 5 def redis_pool @redis_pool end |
Class Method Details
.valid_for(*origins) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/canvas_sync/job_uniqueness/on_conflict/base.rb', line 9 def self.valid_for(*origins) if origins.present? orgins = Array(origins).map(&:to_sym) self._valid_for = origins else self._valid_for || [:enqueue, :perform] end end |
Instance Method Details
#call ⇒ Object
23 24 25 |
# File 'lib/canvas_sync/job_uniqueness/on_conflict/base.rb', line 23 def call raise NotImplementedError, "needs to be implemented in child class" end |
#replace? ⇒ Boolean
27 28 29 |
# File 'lib/canvas_sync/job_uniqueness/on_conflict/base.rb', line 27 def replace? is_a?(Replace) end |