aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--lib/mathn.rb1
2 files changed, 6 insertions, 0 deletions
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 <zn@mbf.nifty.com>
+
+ * lib/mathn.rb (Prime#each): returns an enumerator if no block
+ given. [ruby-dev:32815]
+
Wed Jan 9 22:03:26 2008 NARUSE, Yui <naruse@ruby-lang.org>
* 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