Class: Sequence

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

Instance Method Summary collapse

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

#nextObject

:nodoc



7
8
9
10
# File 'lib/machine/sequence.rb', line 7

def next #:nodoc
  @current_value += 1
  @proc.call(@current_value)
end