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/module
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
shared
alias_method_spec.rb
ancestors_spec.rb
append_features_spec.rb
attr_accessor_spec.rb
attr_reader_spec.rb
attr_spec.rb
attr_writer_spec.rb
autoload_spec.rb Update to ruby/spec@254c380 2021-10-20 21:57:05 +02:00
case_compare_spec.rb
class_eval_spec.rb
class_exec_spec.rb
class_variable_defined_spec.rb
class_variable_get_spec.rb
class_variable_set_spec.rb
class_variables_spec.rb
comparison_spec.rb
const_defined_spec.rb
const_get_spec.rb
const_missing_spec.rb
const_set_spec.rb Update to ruby/spec@254c380 2021-10-20 21:57:05 +02:00
const_source_location_spec.rb
constants_spec.rb Update to ruby/spec@d6921ef 2021-10-20 21:41:46 +02:00
define_method_spec.rb
define_singleton_method_spec.rb
deprecate_constant_spec.rb Update to ruby/spec@21a48d9 2021-10-28 18:54:01 +02:00
eql_spec.rb
equal_spec.rb
equal_value_spec.rb
extend_object_spec.rb
extended_spec.rb
freeze_spec.rb
gt_spec.rb
gte_spec.rb
include_spec.rb
included_modules_spec.rb
included_spec.rb
initialize_copy_spec.rb
initialize_spec.rb
instance_method_spec.rb
instance_methods_spec.rb
lt_spec.rb
lte_spec.rb
method_added_spec.rb
method_defined_spec.rb
method_removed_spec.rb
method_undefined_spec.rb
module_eval_spec.rb
module_exec_spec.rb
module_function_spec.rb Make Module#{public,private,protected,module_function} return arguments 2021-11-18 09:47:40 -08:00
name_spec.rb
nesting_spec.rb
new_spec.rb
prepend_features_spec.rb
prepend_spec.rb
prepended_spec.rb
private_class_method_spec.rb Update to ruby/spec@21a48d9 2021-10-28 18:54:01 +02:00
private_constant_spec.rb
private_instance_methods_spec.rb
private_method_defined_spec.rb
private_spec.rb Make Module#{public,private,protected,module_function} return arguments 2021-11-18 09:47:40 -08:00
protected_instance_methods_spec.rb
protected_method_defined_spec.rb
protected_spec.rb Make Module#{public,private,protected,module_function} return arguments 2021-11-18 09:47:40 -08:00
public_class_method_spec.rb Update to ruby/spec@21a48d9 2021-10-28 18:54:01 +02:00
public_constant_spec.rb
public_instance_method_spec.rb
public_instance_methods_spec.rb
public_method_defined_spec.rb
public_spec.rb Make Module#{public,private,protected,module_function} return arguments 2021-11-18 09:47:40 -08:00
refine_spec.rb Refinement#include and Refinement#prepend have been deprecated 2021-10-22 15:06:41 +09:00
remove_class_variable_spec.rb
remove_const_spec.rb
remove_method_spec.rb
ruby2_keywords_spec.rb
singleton_class_spec.rb
to_s_spec.rb
undef_method_spec.rb
using_spec.rb