[ruby-core:93272] [Ruby trunk Feature#15777] autoload?(cname, inherit=true)
From:
nobu@...
Date:
2019-06-20 06:49:56 UTC
List:
ruby-core #93272
Issue #15777 has been updated by nobu (Nobuyoshi Nakada).
byroot (Jean Boussier) wrote:
> Let me know if you desire further changes.
Fix the bug first.
In `rb_autoload_at_p`, this condition is wrong.
```diff
- while (!autoload_defined_p(mod, id)) {
+ while (RTEST(recur) && autoload_defined_p(mod, id)) {
```
Leave it unchanged but return `nil` if not `recur` in that loop.
----------------------------------------
Feature #15777: autoload?(cname, inherit=true)
https://bugs.ruby-lang.org/issues/15777#change-78731
* Author: fxn (Xavier Noria)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
----------------------------------------
Zeitwerk needs to be able to check if a given class or module has an autoload defined for a certain constant name, that would be `autoload?(cname, false)`, similar to `const_defined?(cname, false)`.
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>