Project

General

Profile

Actions

Bug #3792

closed

Procs created via Method#to_proc and Symbol#to_proc don't pass a block thru

Added by tmat (Tomas Matousek) over 13 years ago. Updated almost 13 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 1.9.2p0 (2010-08-18) [i386-mingw32]
Backport:
[ruby-core:32075]

Description

=begin
class C
def foo
yield
end
end

f = :foo.to_proc
f.(C.new) { puts 'bar' } rescue p $!

m = C.new.method(:foo)
q = m.to_proc
q.() { puts 'bar' } rescue p $!

Output:

#<LocalJumpError: no block given (yield)>
#<LocalJumpError: no block given (yield)>

Expected:
bar
bar
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0