Project

General

Profile

Bug #7493 » CRuby1.8.7.rb

CRuby-1.8.7 - kachick (Kenichi Kamiya), 12/02/2012 01:35 PM

 
1
# * ruby 1.8.7 (2012-10-12 patchlevel 371) [x86_64-linux]
2

    
3
array = [:a, :b, :c]
4

    
5
index_enum = array.index
6
index_enum.to_a #=> [:a, :b, :c]
7
index_enum.next #=> :a
8
index_enum.next #=> StopIteration: iteration reached at end
9
index_enum.next
10

    
11
find_index_enum = array.find_index
12
find_index_enum.to_a #=> [:a, :b, :c]
13
find_index_enum.next #=> :a
14
find_index_enum.next #=> StopIteration: iteration reached at end
15
find_index_enum.next
16

    
17
rindex_enum = array.rindex
18
rindex_enum.to_a #=> [:c, :b, :a]
19
rindex_enum.next #=> :c
20
rindex_enum.next #=> StopIteration: iteration reached at end
21
rindex_enum.next
22

    
23
find_enum = array.find
24
find_enum.to_a #=> [:a, :b, :c]
25
find_enum.next #=> :a
26
find_enum.next #=> StopIteration: iteration reached at end
27
find_enum.next
28

    
29
detect_enum = array.detect
30
detect_enum.to_a #=> [:a, :b, :c]
31
detect_enum.next #=> :a
32
detect_enum.next #=> StopIteration: iteration reached at end
33
detect_enum.next