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.
90 91 92 |
# File 'lib/object_factory.rb', line 90 def initialize @counter = 0 end |
Instance Method Details
#unique_integer ⇒ Object
94 95 96 |
# File 'lib/object_factory.rb', line 94 def unique_integer @counter += 1 end |
#value_for(klass, field) ⇒ Object
98 99 100 |
# File 'lib/object_factory.rb', line 98 def value_for klass, field "#{klass.name.to_s}-#{field.to_s}-#{unique_integer}" end |