diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/syntax/methods.rdoc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/doc/syntax/methods.rdoc b/doc/syntax/methods.rdoc index bdc555b131..eff38c3410 100644 --- a/doc/syntax/methods.rdoc +++ b/doc/syntax/methods.rdoc @@ -147,7 +147,7 @@ evaluated. 1 + 1 # this expression is never evaluated end -Note that for assignment methods the return value will always be ignored. +Note that for assignment methods the return value will be ignored when using the assignment syntax. Instead, the argument will be returned: def a=(value) @@ -155,6 +155,10 @@ Instead, the argument will be returned: end p(a = 5) # prints 5 + +The actual return value will be returned when invoking the method directly: + + p send(:a=, 5) # prints 6 == Scope |