Age | Commit message (Collapse) | Author |
|
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]
Notes:
Merged: https://github.com/ruby/ruby/pull/5037
|
|
|
|
|
|
|
|
|
|
|
|
Previously, if an autoload failed (the file was loaded, but the
constant was not defined by the autoloaded file). Ruby will try
to autoload again if you delete the autoloaded file from
$LOADED_FEATURES. With this change, the autoload and the
constant itself are removed as soon as it fails.
To handle cases where multiple threads are autoloading, when
deleting an autoload, handle the case where another thread
already deleted it.
Fixes [Bug #15790]
Notes:
Merged: https://github.com/ruby/ruby/pull/4715
Merged-By: jeremyevans <code@jeremyevans.net>
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/4858
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
symbols (#3935)
Co-authored-by: Yusuke Endoh <mame@ruby-lang.org>
Notes:
Merged-By: mame <mame@ruby-lang.org>
|
|
alias_method"
This reverts commit 81739ad4fdfcc86a769056fec352f27c686fba1b.
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/3757
|
|
|
|
|
|
|
|
And `-w` option turns it on.
Notes:
Merged: https://github.com/ruby/ruby/pull/3481
|
|
refinement"
This reverts commit eeef16e190cdabc2ba474622720f8e3df7bac43b.
This also reverts the spec change.
Preventing the SystemStackError would be nice, but there is valid
code that the fix breaks, and it is probably more common than cases
that cause the SystemStackError.
Fixes [Bug #17182]
Notes:
Merged: https://github.com/ruby/ruby/pull/3564
|
|
|
|
Fixes [Bug #14895]
Notes:
Merged: https://github.com/ruby/ruby/pull/3502
|
|
|
|
|
|
|
|
This fixes various issues when a module is included in or prepended
to a module or class, and then refined, or refined and then included
or prepended to a module or class.
Implement by renaming ensure_origin to rb_ensure_origin, making it
non-static, and calling it when refining a module.
Fix Module#initialize_copy to handle origins correctly. Previously,
Module#initialize_copy did not handle origins correctly. For example,
this code:
```ruby
module B; end
class A
def b; 2 end
prepend B
end
a = A.dup.new
class A
def b; 1 end
end
p a.b
```
Printed 1 instead of 2. This is because the super chain for
a.singleton_class was:
```
a.singleton_class
A.dup
B(iclass)
B(iclass origin)
A(origin) # not A.dup(origin)
```
The B iclasses would not be modified, so the includer entry would be
still be set to A and not A.dup.
This modifies things so that if the class/module has an origin,
all iclasses between the class/module and the origin are duplicated
and have the correct includer entry set, and the correct origin
is created.
This requires other changes to make sure all tests still pass:
* rb_undef_methods_from doesn't automatically handle classes with
origins, so pass it the origin for Comparable when undefing
methods in Complex. This fixed a failure in the Complex tests.
* When adding a method, the method cache was not cleared
correctly if klass has an origin. Clear the method cache for
the klass before switching to the origin of klass. This fixed
failures in the autoload tests related to overridding require,
without breaking the optimization tests. Also clear the method
cache for both the module and origin when removing a method.
* Module#include? is fixed to skip origin iclasses.
* Refinements are fixed to use the origin class of the module that
has an origin.
* RCLASS_REFINED_BY_ANY is removed as it was only used in a single
place and is no longer needed.
* Marshal#dump is fixed to skip iclass origins.
* rb_method_entry_make is fixed to handled overridden optimized
methods for modules that have origins.
Fixes [Bug #16852]
Notes:
Merged: https://github.com/ruby/ruby/pull/3140
|
|
|
|
|
|
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/2892
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/2892
|
|
|
|
|
|
Fixed misspellings reported at [Bug #16437], only in ruby and rubyspec.
|
|
|
|
This removes the related tests, and puts the related specs behind
version guards. This affects all code in lib, including some
libraries that may want to support older versions of Ruby.
Notes:
Merged: https://github.com/ruby/ruby/pull/2476
|
|
* Always the same frozen String for a given Module or Class.
* Avoids extra allocations whenever calling Module#name.
* See [Feature #16150]
Notes:
Merged: https://github.com/ruby/ruby/pull/2487
|
|
|
|
|
|
|
|
|
|
|
|
[Feature #15777]
Closes: https://github.com/ruby/ruby/pull/2173
|