summaryrefslogtreecommitdiff
path: root/lib/mathn.rb
diff options
context:
space:
mode:
authorkazu <kazu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-09 13:10:31 +0000
committerkazu <kazu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-09 13:10:31 +0000
commitcbf7c9adde39ac857511fc85c1521205bd017328 (patch)
tree03518fd3e8288bb044ac408d6b7edf9a3334bbee /lib/mathn.rb
parentad4fb57a3aea3bf5c1ca2a1fa937e549321e021a (diff)
* 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
Diffstat (limited to 'lib/mathn.rb')
-rw-r--r--lib/mathn.rb1
1 files changed, 1 insertions, 0 deletions
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