ruby-changes:48231
From: rhe <ko1@a...>
Date: Sun, 22 Oct 2017 13:19:08 +0900 (JST)
Subject: [ruby-changes:48231] rhe:r60346 (trunk): doc/syntax/methods.rdoc: fix a misleading example
rhe 2017-10-22 13:19:03 +0900 (Sun, 22 Oct 2017) New Revision: 60346 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60346 Log: doc/syntax/methods.rdoc: fix a misleading example As a bonus, wrap a long line added by r60295. Modified files: trunk/doc/syntax/methods.rdoc Index: doc/syntax/methods.rdoc =================================================================== --- doc/syntax/methods.rdoc (revision 60345) +++ doc/syntax/methods.rdoc (revision 60346) @@ -147,14 +147,14 @@ evaluated. https://github.com/ruby/ruby/blob/trunk/doc/syntax/methods.rdoc#L147 1 + 1 # this expression is never evaluated end -Note that for assignment methods the return value will be ignored when using the assignment syntax. -Instead, the argument will be returned: +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) return 1 + value end - p(a = 5) # prints 5 + p(self.a = 5) # prints 5 The actual return value will be returned when invoking the method directly: -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/