Project

General

Profile

Bug #7493 » Other.rb

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

 
1
# * ruby 2.0.0dev (2012-12-01) [x86_64-linux]
2
# * ruby 1.9.3p332 (2012-11-15) [x86_64-linux]
3
# * jruby 1.7.1.dev (1.9.3p327) 2012-12-02 fffffff on OpenJDK 64-Bit Server VM 1.6.0_24-b24 [linux-amd64]
4
# * jruby 1.7.1.dev (ruby-1.8.7p370) 2012-12-02 fffffff on OpenJDK 64-Bit Server VM 1.6.0_24-b24 [linux-amd64]
5

    
6
array = [:a, :b, :c]
7

    
8
index_enum = array.index
9
index_enum.to_a #=> [:a, :b, :c]
10
index_enum.next #=> :a
11
index_enum.next #=> :b
12
index_enum.next #=> :c
13

    
14
find_index_enum = array.find_index
15
find_index_enum.to_a #=> [:a, :b, :c]
16
find_index_enum.next #=> :a
17
find_index_enum.next #=> :b
18
find_index_enum.next #=> :c
19

    
20
rindex_enum = array.rindex
21
rindex_enum.to_a #=> [:c, :b, :a]
22
rindex_enum.next #=> :c
23
rindex_enum.next #=> :b
24
rindex_enum.next #=> :a
25

    
26
find_enum = array.find
27
find_enum.to_a #=> [:a, :b, :c]
28
find_enum.next #=> :a
29
find_enum.next #=> :b
30
find_enum.next #=> :c
31

    
32
detect_enum = array.detect
33
detect_enum.to_a #=> [:a, :b, :c]
34
detect_enum.next #=> :a
35
detect_enum.next #=> :b
36
detect_enum.next #=> :c