Class: IdGenerator
- Inherits:
-
Object
- Object
- IdGenerator
- Defined in:
- lib/id_generator.rb
Defined Under Namespace
Classes: Error
Constant Summary collapse
- VERSION =
'0.1.1'.freeze
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(context_id) ⇒ IdGenerator
constructor
A new instance of IdGenerator.
Constructor Details
#initialize(context_id) ⇒ IdGenerator
9 10 11 |
# File 'lib/id_generator.rb', line 9 def initialize(context_id) @context_id = context_id.to_i end |
Instance Method Details
#generate ⇒ Object
13 14 15 16 17 |
# File 'lib/id_generator.rb', line 13 def generate validate_context_id "#{time}-#{@context_id}-#{random_number}" end |