Class: KuberKit::Shell::CommandCounter
- Defined in:
- lib/kuber_kit/shell/command_counter.rb
Instance Method Summary collapse
- #get_number ⇒ Object
-
#initialize ⇒ CommandCounter
constructor
A new instance of CommandCounter.
- #reset! ⇒ Object
Constructor Details
#initialize ⇒ CommandCounter
Returns a new instance of CommandCounter.
2 3 4 |
# File 'lib/kuber_kit/shell/command_counter.rb', line 2 def initialize @mutex = Mutex.new end |
Instance Method Details
#get_number ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/kuber_kit/shell/command_counter.rb', line 6 def get_number @mutex.synchronize do @@number ||= 0 @@number += 1 @@number end end |
#reset! ⇒ Object
14 15 16 17 18 |
# File 'lib/kuber_kit/shell/command_counter.rb', line 14 def reset! @mutex.synchronize do @@number = 0 end end |