From cbf7c9adde39ac857511fc85c1521205bd017328 Mon Sep 17 00:00:00 2001 From: kazu Date: Wed, 9 Jan 2008 13:10:31 +0000 Subject: [PATCH] * lib/mathn.rb (Prime#each): returns an enumerator if no block given. [ruby-dev:32815] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ lib/mathn.rb | 1 + 2 files changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index 9eaf3b7623..dfdbae66b0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Jan 9 22:04:17 2008 Kazuhiro NISHIYAMA + + * lib/mathn.rb (Prime#each): returns an enumerator if no block + given. [ruby-dev:32815] + Wed Jan 9 22:03:26 2008 NARUSE, Yui * encoding.c (rb_enc_replicate): replica of dummy is a dummy. diff --git a/lib/mathn.rb b/lib/mathn.rb index 1c68a4bb03..3e24dd03f3 100644 --- a/lib/mathn.rb +++ b/lib/mathn.rb @@ -101,6 +101,7 @@ class Prime alias next succ def each + return to_enum(:each) unless block_given? loop do yield succ end