aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_refinement.rb
diff options
context:
space:
mode:
authorDylan Thacker-Smith <Dylan.Smith@shopify.com>2019-07-02 15:06:54 +0100
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-09-20 02:20:59 +0900
commit7fbd2f7cc247ee66e877ab3c88f0274834c6b6c7 (patch)
tree1d03cfc0cba9aabb542306f7f1f685dfb636f0c1 /test/ruby/test_refinement.rb
parent17a13663998a98ff75fcc838d1cea95c879fbb88 (diff)
downloadruby-7fbd2f7cc247ee66e877ab3c88f0274834c6b6c7.tar.gz
Allow calling a private method with `self.`
This makes it consistent with calling private attribute assignment methods, which currently is allowed (e.g. `self.value =`). Calling a private method in this way can be useful when trying to assign the return value to a local variable with the same name. [Feature #11297] [Feature #16123]
Diffstat (limited to 'test/ruby/test_refinement.rb')
-rw-r--r--test/ruby/test_refinement.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/test/ruby/test_refinement.rb b/test/ruby/test_refinement.rb
index 87d60e41a4..4be0720983 100644
--- a/test/ruby/test_refinement.rb
+++ b/test/ruby/test_refinement.rb
@@ -538,7 +538,7 @@ class TestRefinement < Test::Unit::TestCase
def test_main_using_is_private
assert_raise(NoMethodError) do
- eval("self.using Module.new", Sandbox::BINDING)
+ eval("recv = self; recv.using Module.new", Sandbox::BINDING)
end
end