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/main
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
..
fixtures Feature 17314: allow to pass array to public, protected and private methods 2020-12-19 18:19:49 +09:00
define_method_spec.rb
include_spec.rb
private_spec.rb Make Module#{public,private,protected,module_function} return arguments 2021-11-18 09:47:40 -08:00
public_spec.rb Make Module#{public,private,protected,module_function} return arguments 2021-11-18 09:47:40 -08:00
ruby2_keywords_spec.rb Update to ruby/spec@37e52e5 2021-02-27 13:00:26 +01:00
to_s_spec.rb
using_spec.rb