From 9f1fb0a17febc59356d58cef5e98db61a3c03550 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 10 Jan 2019 08:19:14 +0000 Subject: proc.c: proc without block * proc.c (proc_new): promoted lambda/proc/Proc.new with no block in a method called with a block to a warning/error. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/prime.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/prime.rb') 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 -- cgit v1.2.3