Flowdock
method

result

Importance_1
v1_9_2_180 - Show latest stable - 0 notes - Class: StopIteration
result() public

Returns the return value of the iterator.

o = Object.new
def o.each
  yield 1
  yield 2
  yield 3
  100
end
e = o.to_enum
p e.next                   #=> 1
p e.next                   #=> 2
p e.next                   #=> 3
begin
  e.next
rescue StopIteration
  p $!.result              #=> 100
end
Show source
Register or log in to add new notes.