summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-11 12:14:10 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-11 12:14:10 +0000
commit5d8659a195065794642cd7cc0872c724812b67bd (patch)
treec79fa57ed7d0c62ae235ec903683e1e2e9e9b0f7 /lib
parentdd5a95a14c2c4bc223c4abbc3d1b64e144693d99 (diff)
* enumerator.c (enumerator_next, enumerator_rewind),
lib/generator.rb (Enumerator#rewind): If the enclosed object responds to a "rewind" method, call it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@20645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/generator.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/generator.rb b/lib/generator.rb
index 03527af331..e6034a9f9a 100644
--- a/lib/generator.rb
+++ b/lib/generator.rb
@@ -193,12 +193,18 @@ class Enumerator
raise StopIteration, 'iteration reached at end'
end
+ # :nodoc:
+ alias __orig_rewind rewind
+
# call-seq:
# e.rewind => e
#
# Rewinds the enumeration sequence by the next method.
+ #
+ # If the enclosed object responds to a "rewind" method, it is called.
def rewind
__generator.rewind
+ __orig_rewind
self
end
end