summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-21 15:19:45 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-21 15:19:45 +0000
commit86f1d9b705e460960ea97b6d0084a07cb05e4023 (patch)
tree68dbd222e664238d8b16e69a9a264547860b7c94 /doc
parent2476bf2bb15f1b84363d9400c4994702ba3b59cf (diff)
Clarify return value for assignment methods.
https://github.com/ruby/ruby/pull/1682 Patch by @sos4nt [fix GH-1682] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60295 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'doc')
-rw-r--r--doc/syntax/methods.rdoc6
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