Class: Object::Factory::ValueGenerator

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

Overview

A simple class that generates unique values

Instance Method Summary collapse

Constructor Details

#initializeValueGenerator

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_integerObject



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