Class: Gitlab::Utils::Uniquify

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/utils/uniquify.rb

Instance Method Summary collapse

Constructor Details

#initialize(counter = nil) ⇒ Uniquify

Returns a new instance of Uniquify.



18
19
20
# File 'lib/gitlab/utils/uniquify.rb', line 18

def initialize(counter = nil)
  @counter = counter
end

Instance Method Details

#string(base) ⇒ Object



22
23
24
25
26
27
# File 'lib/gitlab/utils/uniquify.rb', line 22

def string(base)
  @base = base

  increment_counter! while yield(base_string)
  base_string
end