From 7fbd2f7cc247ee66e877ab3c88f0274834c6b6c7 Mon Sep 17 00:00:00 2001 From: Dylan Thacker-Smith Date: Tue, 2 Jul 2019 15:06:54 +0100 Subject: 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] --- spec/ruby/language/send_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec') diff --git a/spec/ruby/language/send_spec.rb b/spec/ruby/language/send_spec.rb index 4ba3dcc9c2..cce2e1acb9 100644 --- a/spec/ruby/language/send_spec.rb +++ b/spec/ruby/language/send_spec.rb @@ -260,7 +260,7 @@ end describe "Invoking a private getter method" do it "does not permit self as a receiver" do receiver = LangSendSpecs::PrivateGetter.new - -> { receiver.call_self_foo }.should raise_error(NoMethodError) + -> { receiver.call_self_foo }.should_not raise_error(NoMethodError) -> { receiver.call_self_foo_or_equals(6) }.should raise_error(NoMethodError) end end -- cgit v1.2.3