Feature #11297
Updated by nobu (Nobuyoshi Nakada) about 9 years ago
Ruby does not allow private method to be called if receiver is given. Calling private method with receiver is prohibited even if it is written as self, though the fact that the receiver is self is still clear. This ticket is to propose to allow the private method to be called if its receiver is written as self. The following Ruby program is to explain my idea. ~~~ruby ~~~ class A private def f end end A.new.instance_eval do f() # Okay, without receiver self.f # Currently NoMethodError, but should be okay in my opinion self.itself.f # NoMethodError anyway; the receiver is not written as self end ~~~ This change will allow to call private accessor method like `self.title=`. self.title=. It also will make refactoring to make a public method private easier. Currently, such kind of refactoring may require to rename duplicated local variables or add `()` () to method calls.