parent
e6378cdcd8
commit
b80df6e8e0
3
NEWS
3
NEWS
@ -77,6 +77,9 @@ sufficient information, see the ChangeLog file or Redmine
|
|||||||
# .bar
|
# .bar
|
||||||
.baz # => foo.baz
|
.baz # => foo.baz
|
||||||
|
|
||||||
|
* Calling a private method with a literal <code>self.</code> as the receiver
|
||||||
|
is now allowed. [Feature #11297] [Feature #16123]
|
||||||
|
|
||||||
=== Core classes updates (outstanding ones only)
|
=== Core classes updates (outstanding ones only)
|
||||||
|
|
||||||
Complex::
|
Complex::
|
||||||
|
@ -93,7 +93,8 @@ be cached. To call the method, use <code>self.big_calculation</code>.
|
|||||||
|
|
||||||
You can force a method call by using empty argument parentheses as shown above
|
You can force a method call by using empty argument parentheses as shown above
|
||||||
or by using an explicit receiver like <code>self.</code>. Using an explicit
|
or by using an explicit receiver like <code>self.</code>. Using an explicit
|
||||||
receiver may raise a NameError if the method's visibility is not public.
|
receiver may raise a NameError if the method's visibility is not public or the
|
||||||
|
receiver is the literal <code>self</code>.
|
||||||
|
|
||||||
Another commonly confusing case is when using a modifier +if+:
|
Another commonly confusing case is when using a modifier +if+:
|
||||||
|
|
||||||
|
@ -191,8 +191,8 @@ Here is an example:
|
|||||||
a.n b # raises NoMethodError A is not a subclass of B
|
a.n b # raises NoMethodError A is not a subclass of B
|
||||||
|
|
||||||
The third visibility is +private+. A private method may not be called with a
|
The third visibility is +private+. A private method may not be called with a
|
||||||
receiver, not even +self+. If a private method is called with a receiver a
|
receiver, not even if it equals +self+. If a private method is called with a
|
||||||
NoMethodError will be raised.
|
receiver other than a literal +self+ a NoMethodError will be raised.
|
||||||
|
|
||||||
=== +alias+ and +undef+
|
=== +alias+ and +undef+
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user