Class: KuberKit::Shell::CommandCounter

Inherits:
Object
  • Object
show all
Defined in:
lib/kuber_kit/shell/command_counter.rb

Instance Method Summary collapse

Constructor Details

#initializeCommandCounter

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_numberObject



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