diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-11-04 20:36:20 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-11-04 20:36:20 +0000 |
commit | 1eee78b8769f7f01cead3b0782e1ee4ed84e281b (patch) | |
tree | 32ac34a556e40ef93a8e4a15f328d36886b4fc45 /bootstraptest/test_method.rb | |
parent | ed823523e32e8e8a04123ee5b8ec9c0f3de63c02 (diff) |
* eval.c (rb_f_send): allow send/__send__ to call methods of all
visibility again. we no longer provide __send, __send!.
* eval.c (rb_invoke_method): new method to honor private
visibility. if it's invoked in a function call style, it calls
private methods as well (previous 1.9 send behavior).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13824 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bootstraptest/test_method.rb')
-rw-r--r-- | bootstraptest/test_method.rb | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/bootstraptest/test_method.rb b/bootstraptest/test_method.rb index 54ba5f8442..76901f6f6e 100644 --- a/bootstraptest/test_method.rb +++ b/bootstraptest/test_method.rb @@ -314,9 +314,9 @@ assert_equal '1', %q( class C; def m(x,a=7) a end end; assert_equal '[1, 2]', %q( class C; def m(*a) a end end; C.new.send(:m,1,2).inspect ) assert_equal '1', %q( class C; def m() 7 end; private :m end - begin C.new.send(:m); rescue NoMethodError; 1 end ) + begin C.new.invoke_method(:m); rescue NoMethodError; 1 end ) assert_equal '1', %q( class C; def m() 1 end; private :m end - C.new.send!(:m) ) + C.new.send(:m) ) # with block assert_equal '[[:ok1, :foo], [:ok2, :foo, :bar]]', @@ -867,8 +867,6 @@ assert_equal %q{[:ok, :ok, :ok, :ok, :ok, :ok, :ng, :ng]}, %q{ end end - alias send! send unless defined? send! - c1 = c2 = nil lambda{ @@ -899,8 +897,8 @@ assert_equal %q{[:ok, :ok, :ok, :ok, :ok, :ok, :ng, :ng]}, %q{ test{o2.mm} test{o1.send :m} test{o2.send :mm} - test{o1.send! :m} - test{o2.send! :mm} + test{o1.invoke_method :m} + test{o2.invoke_method :mm} test{o1.method(:m).call} test{o2.method(:mm).call} $ans |