Method: When::Parts::Enumerator#each

Defined in:
lib/when_exe/parts/enumerator.rb

#eachrewind された self

ブロックを評価する

Returns:



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/when_exe/parts/enumerator.rb', line 101

def each
  return self unless block_given?
  while (has_next?) do
    if @index
      yield(succ, @index)
      @index += 1
    elsif @object
      yield(succ, @object)
    else
      yield(succ)
    end
  end
  @index = @object = nil
  rewind
end