class MultiBackgroundJob::LockDigest
Class Lock
generates the uniq digest acording to the uniq config
Constants
- BASE
- SEPARATOR
Public Class Methods
new(*keys, across:)
click to toggle source
# File lib/multi_background_job/lock_digest.rb, line 9 def initialize(*keys, across:) @keys = keys.map { |k| k.to_s.strip.downcase } @across = across.to_sym end
Public Instance Methods
to_s()
click to toggle source
# File lib/multi_background_job/lock_digest.rb, line 14 def to_s case @across when :systemwide build_name(*@keys.slice(0..-2)) when :queue build_name(*@keys) else raise Error, format( 'Could not resolve the lock digest using across %<across>p. ' + 'Valid options are :systemwide and :queue', across: @across, ) end end
Private Instance Methods
build_name(*segments)
click to toggle source
# File lib/multi_background_job/lock_digest.rb, line 31 def build_name(*segments) [namespace, BASE, *segments].compact.join(SEPARATOR) end
namespace()
click to toggle source
# File lib/multi_background_job/lock_digest.rb, line 35 def namespace MultiBackgroundJob.config.redis_namespace end