Class: Factory::Sequence

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

Instance Method Summary collapse

Constructor Details

#initialize(&proc) ⇒ Sequence

Returns a new instance of Sequence.



5
6
7
8
# File 'lib/factory_girl/sequence.rb', line 5

def initialize (&proc)
  @proc  = proc
  @value = 0
end

Instance Method Details

#nextObject



10
11
12
13
# File 'lib/factory_girl/sequence.rb', line 10

def next
  @value += 1
  @proc.call(@value)
end