mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
75ecbda438
Previously, each of these methods returned self, but it is more useful to return arguments, to allow for simpler method decorators, such as: ```ruby cached private def foo; some_long_calculation; end ``` Where cached sets up caching for the method. For each of these methods, the following behavior is used: 1) No arguments returns nil 2) Single argument is returned 3) Multiple arguments are returned as an array The single argument case is really the case we are trying to optimize for, for the same reason that def was changed to return a symbol for the method. Idea and initial patch from Herwin Quarantainenet. Implements [Feature #12495] |
||
---|---|---|
.. | ||
argf | ||
array | ||
basicobject | ||
binding | ||
builtin_constants | ||
class | ||
comparable | ||
complex | ||
conditionvariable | ||
data | ||
dir | ||
encoding | ||
enumerable | ||
enumerator | ||
env | ||
exception | ||
false | ||
fiber | ||
file | ||
filetest | ||
float | ||
gc | ||
hash | ||
integer | ||
io | ||
kernel | ||
main | ||
marshal | ||
matchdata | ||
math | ||
method | ||
module | ||
mutex | ||
nil | ||
numeric | ||
objectspace | ||
proc | ||
process | ||
queue | ||
random | ||
range | ||
rational | ||
regexp | ||
signal | ||
sizedqueue | ||
string | ||
struct | ||
symbol | ||
systemexit | ||
thread | ||
threadgroup | ||
time | ||
tracepoint | ||
true | ||
unboundmethod | ||
warning |