Class: Factory::Sequence
- Inherits:
-
Object
- Object
- Factory::Sequence
- Defined in:
- lib/factory_girl/sequence.rb
Instance Method Summary collapse
-
#initialize(&proc) ⇒ Sequence
constructor
:nodoc:.
-
#next ⇒ Object
Returns the next value for this sequence.
Constructor Details
#initialize(&proc) ⇒ Sequence
:nodoc:
5 6 7 8 |
# File 'lib/factory_girl/sequence.rb', line 5 def initialize (&proc) #:nodoc: @proc = proc @value = 0 end |
Instance Method Details
#next ⇒ Object
Returns the next value for this sequence
11 12 13 14 |
# File 'lib/factory_girl/sequence.rb', line 11 def next @value += 1 @proc.call(@value) end |