1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/spec/ruby/core
Jeremy Evans 75ecbda438 Make Module#{public,private,protected,module_function} return arguments
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]
2021-11-18 09:47:40 -08:00
..
argf
array Update to ruby/spec@21a48d9 2021-10-28 18:54:01 +02:00
basicobject
binding
builtin_constants
class Add Class#descendants 2021-10-26 12:35:21 -07:00
comparable
complex Fix typos 2021-11-02 19:17:37 +09:00
conditionvariable
data
dir Expect bool as sort: option at glob [Feature #18287] 2021-11-18 21:47:18 +09:00
encoding
enumerable Update to ruby/spec@21a48d9 2021-10-28 18:54:01 +02:00
enumerator
env
exception
false
fiber Update to ruby/spec@21a48d9 2021-10-28 18:54:01 +02:00
file
filetest
float
gc Cleanup GC.auto_compact spec 2021-10-29 21:59:35 +02:00
hash
integer
io Update to ruby/spec@21a48d9 2021-10-28 18:54:01 +02:00
kernel Update to ruby/spec@21a48d9 2021-10-28 18:54:01 +02:00
main Make Module#{public,private,protected,module_function} return arguments 2021-11-18 09:47:40 -08:00
marshal
matchdata
math
method
module Make Module#{public,private,protected,module_function} return arguments 2021-11-18 09:47:40 -08:00
mutex
nil
numeric
objectspace
proc
process
queue
random Update to ruby/spec@21a48d9 2021-10-28 18:54:01 +02:00
range
rational
regexp
signal
sizedqueue
string Update to ruby/spec@21a48d9 2021-10-28 18:54:01 +02:00
struct Fix typos 2021-11-02 19:17:37 +09:00
symbol Update to ruby/spec@21a48d9 2021-10-28 18:54:01 +02:00
systemexit
thread Update to ruby/spec@21a48d9 2021-10-28 18:54:01 +02:00
threadgroup
time
tracepoint
true
unboundmethod
warning Update to ruby/spec@21a48d9 2021-10-28 18:54:01 +02:00