Class: Sequence
- Inherits:
-
Object
- Object
- Sequence
- Defined in:
- lib/machine/sequence.rb
Instance Method Summary collapse
-
#initialize(proc) ⇒ Sequence
constructor
:nodoc.
-
#next ⇒ Object
:nodoc.
Constructor Details
#initialize(proc) ⇒ Sequence
:nodoc
3 4 5 |
# File 'lib/machine/sequence.rb', line 3 def initialize(proc) #:nodoc @proc, @current_value = proc, 0 end |
Instance Method Details
#next ⇒ Object
:nodoc
7 8 9 10 |
# File 'lib/machine/sequence.rb', line 7 def next #:nodoc @current_value += 1 @proc.call(@current_value) end |