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.



90
91
92
# File 'lib/object_factory.rb', line 90

def initialize
  @counter = 0
end

Instance Method Details

#unique_integerObject



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