Class: SuckerPunch::Counter::Busy

Inherits:
Object
  • Object
show all
Includes:
Utilities
Defined in:
lib/sucker_punch/counter.rb

Constant Summary collapse

COUNTER =
Concurrent::Map.new do |hash, name|
  hash.compute_if_absent(name) { Concurrent::AtomicFixnum.new }
end

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Utilities

#decrement, #increment, #value

Constructor Details

#initialize(queue_name) ⇒ Busy

Returns a new instance of Busy.



30
31
32
# File 'lib/sucker_punch/counter.rb', line 30

def initialize(queue_name)
  @counter = COUNTER[queue_name]
end

Instance Attribute Details

#counterObject (readonly)

Returns the value of attribute counter.



18
19
20
# File 'lib/sucker_punch/counter.rb', line 18

def counter
  @counter
end

Class Method Details

.clearObject



26
27
28
# File 'lib/sucker_punch/counter.rb', line 26

def self.clear
  COUNTER.clear
end