Class: GorgonBunny::ConsumerTagGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/gorgon_bunny/lib/gorgon_bunny/consumer_tag_generator.rb

Overview

Used to generate consumer tags in the client

Instance Method Summary collapse

Instance Method Details

#generateString

Returns Generated consumer tag.

Returns:

  • (String)

    Generated consumer tag



10
11
12
# File 'lib/gorgon_bunny/lib/gorgon_bunny/consumer_tag_generator.rb', line 10

def generate
  "#{Kernel.rand}-#{Time.now.to_i * 1000}-#{Kernel.rand(999_999_999_999)}"
end

#generate_prefixed(name = "bunny") ⇒ String

Unique string supposed to be used as a consumer tag.

Returns:

  • (String)

    Unique string.



19
20
21
# File 'lib/gorgon_bunny/lib/gorgon_bunny/consumer_tag_generator.rb', line 19

def generate_prefixed(name = "bunny")
  "#{name}-#{Time.now.to_i * 1000}-#{Kernel.rand(999_999_999_999)}"
end