Sha256: fbfc1dfbc6a7fb018118e6fd825f417bf8401ff504a0cf0e335b20b2471815cf
Contents?: true
Size: 890 Bytes
Versions: 1
Compression:
Stored size: 890 Bytes
Contents
# frozen_string_literal: true module MultiBackgroundJob # Class Lock generates the uniq digest acording to the uniq config class LockDigest BASE = 'uniqueness'.freeze SEPARATOR = ':'.freeze def initialize(*keys, across:) @keys = keys.map { |k| k.to_s.strip.downcase } @across = across.to_sym end 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 def build_name(*segments) [namespace, BASE, *segments].compact.join(SEPARATOR) end def namespace MultiBackgroundJob.config.redis_namespace end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
multi-background-job-0.1.0 | lib/multi_background_job/lock_digest.rb |