Class: Object::Factory::ValueGenerator
Overview
A simple class that generates unique values
Instance Method Summary collapse
-
#initialize ⇒ ValueGenerator
constructor
A new instance of ValueGenerator.
- #unique_integer ⇒ Object
- #value_for(klass, field) ⇒ Object
Constructor Details
#initialize ⇒ ValueGenerator
Returns a new instance of ValueGenerator.
88 89 90 |
# File 'lib/object_factory.rb', line 88 def initialize @counter = 0 end |
Instance Method Details
#unique_integer ⇒ Object
92 93 94 |
# File 'lib/object_factory.rb', line 92 def unique_integer @counter += 1 end |
#value_for(klass, field) ⇒ Object
96 97 98 |
# File 'lib/object_factory.rb', line 96 def value_for klass, field "#{klass.name.to_s}-#{field.to_s}-#{unique_integer}" end |