Class: SidekiqUniqueJobs::Key
- Inherits:
-
Object
- Object
- SidekiqUniqueJobs::Key
- Defined in:
- lib/sidekiq_unique_jobs/key.rb
Overview
Key class wraps logic dealing with various lock keys
Instance Attribute Summary collapse
-
#changelog ⇒ Object
readonly
Returns the value of attribute changelog.
-
#digest ⇒ Object
readonly
Returns the value of attribute digest.
-
#digests ⇒ Object
readonly
Returns the value of attribute digests.
-
#expiring_digests ⇒ Object
readonly
Returns the value of attribute expiring_digests.
-
#info ⇒ Object
readonly
Returns the value of attribute info.
-
#locked ⇒ Object
readonly
Returns the value of attribute locked.
-
#primed ⇒ Object
readonly
Returns the value of attribute primed.
-
#queued ⇒ Object
readonly
Returns the value of attribute queued.
Instance Method Summary collapse
-
#==(other) ⇒ true, false
Compares keys by digest.
-
#initialize(digest) ⇒ Key
constructor
Initialize a new Key.
- #inspect ⇒ Object
-
#to_a ⇒ Array
Returns all keys as an ordered array.
-
#to_s ⇒ String
Provides the only important information about this keys.
Constructor Details
#initialize(digest) ⇒ Key
Initialize a new Key
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/sidekiq_unique_jobs/key.rb', line 46 def initialize(digest) @digest = digest @queued = suffixed_key("QUEUED") @primed = suffixed_key("PRIMED") @locked = suffixed_key("LOCKED") @info = suffixed_key("INFO") @changelog = CHANGELOGS @digests = DIGESTS @expiring_digests = EXPIRING_DIGESTS end |
Instance Attribute Details
#changelog ⇒ Object (readonly)
Returns the value of attribute changelog.
31 32 33 |
# File 'lib/sidekiq_unique_jobs/key.rb', line 31 def changelog @changelog end |
#digest ⇒ Object (readonly)
Returns the value of attribute digest.
11 12 13 |
# File 'lib/sidekiq_unique_jobs/key.rb', line 11 def digest @digest end |
#digests ⇒ Object (readonly)
Returns the value of attribute digests.
35 36 37 |
# File 'lib/sidekiq_unique_jobs/key.rb', line 35 def digests @digests end |
#expiring_digests ⇒ Object (readonly)
Returns the value of attribute expiring_digests.
39 40 41 |
# File 'lib/sidekiq_unique_jobs/key.rb', line 39 def expiring_digests @expiring_digests end |
#info ⇒ Object (readonly)
Returns the value of attribute info.
27 28 29 |
# File 'lib/sidekiq_unique_jobs/key.rb', line 27 def info @info end |
#locked ⇒ Object (readonly)
Returns the value of attribute locked.
23 24 25 |
# File 'lib/sidekiq_unique_jobs/key.rb', line 23 def locked @locked end |
#primed ⇒ Object (readonly)
Returns the value of attribute primed.
19 20 21 |
# File 'lib/sidekiq_unique_jobs/key.rb', line 19 def primed @primed end |
#queued ⇒ Object (readonly)
Returns the value of attribute queued.
15 16 17 |
# File 'lib/sidekiq_unique_jobs/key.rb', line 15 def queued @queued end |
Instance Method Details
#==(other) ⇒ true, false
Compares keys by digest
79 80 81 |
# File 'lib/sidekiq_unique_jobs/key.rb', line 79 def ==(other) digest == other.digest end |
#inspect ⇒ Object
68 69 70 |
# File 'lib/sidekiq_unique_jobs/key.rb', line 68 def inspect digest end |
#to_a ⇒ Array
Returns all keys as an ordered array
88 89 90 |
# File 'lib/sidekiq_unique_jobs/key.rb', line 88 def to_a [digest, queued, primed, locked, info, changelog, digests, expiring_digests] end |
#to_s ⇒ String
Provides the only important information about this keys
63 64 65 |
# File 'lib/sidekiq_unique_jobs/key.rb', line 63 def to_s digest end |