From 43ba2c01e746992e9658000e4df7bb025bfb6b01 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 1 Jul 2014 17:24:02 +0000 Subject: proc.c: Binding#receiver * proc.c (bind_receiver): new method to return the bound receiver of the binding object. [ruby-dev:47613] [Feature #8779] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_proc.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb index 5a22afee85..91279d9d75 100644 --- a/test/ruby/test_proc.rb +++ b/test/ruby/test_proc.rb @@ -1299,4 +1299,14 @@ class TestProc < Test::Unit::TestCase assert_equal(true, b.local_variable_defined?(:a)) assert_equal(false, b.local_variable_defined?(:b)) end + + def test_binding_receiver + feature8779 = '[ruby-dev:47613] [Feature #8779]' + + assert_same(self, binding.receiver, feature8779) + + obj = Object.new + def obj.b; binding; end + assert_same(obj, obj.b.receiver, feature8779) + end end -- cgit v1.2.3