Project

General

Profile

Bug #7493 » Other.rb

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

 
# * ruby 2.0.0dev (2012-12-01) [x86_64-linux]
# * ruby 1.9.3p332 (2012-11-15) [x86_64-linux]
# * 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]
# * 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]

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

index_enum = array.index
index_enum.to_a #=> [:a, :b, :c]
index_enum.next #=> :a
index_enum.next #=> :b
index_enum.next #=> :c

find_index_enum = array.find_index
find_index_enum.to_a #=> [:a, :b, :c]
find_index_enum.next #=> :a
find_index_enum.next #=> :b
find_index_enum.next #=> :c

rindex_enum = array.rindex
rindex_enum.to_a #=> [:c, :b, :a]
rindex_enum.next #=> :c
rindex_enum.next #=> :b
rindex_enum.next #=> :a

find_enum = array.find
find_enum.to_a #=> [:a, :b, :c]
find_enum.next #=> :a
find_enum.next #=> :b
find_enum.next #=> :c

detect_enum = array.detect
detect_enum.to_a #=> [:a, :b, :c]
detect_enum.next #=> :a
detect_enum.next #=> :b
detect_enum.next #=> :c
(2-2/2)