Class: Bunny::ConsumerTagGenerator
- Inherits:
-
Object
- Object
- Bunny::ConsumerTagGenerator
- Defined in:
- lib/bunny/consumer_tag_generator.rb
Overview
Used to generate consumer tags in the client
Instance Method Summary collapse
-
#generate ⇒ String
Generated consumer tag.
-
#generate_prefixed(name = "bunny") ⇒ String
Unique string supposed to be used as a consumer tag.
Instance Method Details
#generate ⇒ String
Returns Generated consumer tag.
10 11 12 13 |
# File 'lib/bunny/consumer_tag_generator.rb', line 10 def generate t = Bunny::Timestamp.now "#{Kernel.rand}-#{t.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.
20 21 22 23 |
# File 'lib/bunny/consumer_tag_generator.rb', line 20 def generate_prefixed(name = "bunny") t = Bunny::Timestamp.now "#{name}-#{t.to_i * 1000}-#{Kernel.rand(999_999_999_999)}" end |