Class: Factory::Sequence
- Inherits:
-
Object
- Object
- Factory::Sequence
- Defined in:
- lib/factory_girl/sequence.rb
Overview
Sequences are defined using Factory.sequence. Sequence values are generated using next.
Instance Method Summary collapse
-
#initialize(&proc) ⇒ Sequence
constructor
:nodoc:.
-
#next ⇒ Object
Returns the next value for this sequence.
Constructor Details
#initialize(&proc) ⇒ Sequence
:nodoc:
10 11 12 13 |
# File 'lib/factory_girl/sequence.rb', line 10 def initialize (&proc) #:nodoc: @proc = proc @value = 0 end |
Instance Method Details
#next ⇒ Object
Returns the next value for this sequence
16 17 18 19 |
# File 'lib/factory_girl/sequence.rb', line 16 def next @value += 1 @proc.call(@value) end |