Suppose I have a class where I define an
self.attribute = 1
According to a comment by @Jörg W Mittag to Alan Skorkin's blog entry Ruby Access Control – Are Private And Protected Methods Only A Guideline?:
Quick note: there is a special case where calling private methods with an explicit receiver is allowed:
If the method name ends with '=' (i.e. it is an attribute writer) and the explicit receiver is 'self', then this works. This is necessary, because setters can only be called with an explicit receiver because of the method/variable ambiguity. Otherwise it wouldn't be possible to call private setters.
Jörg cites no sources, but he's pretty reliable.