summaryrefslogtreecommitdiff
path: root/lib/prime.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/prime.rb')
-rw-r--r--lib/prime.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/prime.rb b/lib/prime.rb
index 9f6db448be..3aa20f8def 100644
--- a/lib/prime.rb
+++ b/lib/prime.rb
@@ -283,9 +283,9 @@ class Prime
end
# see +Enumerator+#with_index.
- def with_index(offset = 0)
- return enum_for(:with_index, offset) { Float::INFINITY } unless block_given?
- return each_with_index(&proc) if offset == 0
+ def with_index(offset = 0, &block)
+ return enum_for(:with_index, offset) { Float::INFINITY } unless block
+ return each_with_index(&block) if offset == 0
each do |prime|
yield prime, offset