From: Ernie Miller Date: 2011-09-07T08:51:38+09:00 Subject: [ruby-core:39315] [Ruby 1.9 - Bug #5288][Open] Method#to_proc Procs have "sticky" bindings Issue #5288 has been reported by Ernie Miller. ---------------------------------------- Bug #5288: Method#to_proc Procs have "sticky" bindings http://redmine.ruby-lang.org/issues/5288 Author: Ernie Miller Status: Open Priority: Normal Assignee: Category: Target version: 1.9.2 ruby -v: ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.1.0] Please see the attached sample script (or view the gist at https://gist.github.com/1197634). It would appear that a Proc object that is obtained via Method#to_proc behaves unlike other Procs when used with instance_exec. I'm not entirely sure that this is a bug so much as a gap in documentation, but I found it interesting, in either case, to note the subtle difference. The summary: A Proc object created by Method#to_proc doesn't actually allow instance_exec to modify "self" for the block. Sample output is provided in the comments of the attached script. Thanks in advance! -- http://redmine.ruby-lang.org