diff options
author | Jean Boussier <[email protected]> | 2019-05-07 12:52:24 +0200 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2019-06-21 17:28:37 +0900 |
commit | fb85a428605265a8fd449b0702a4dd88cb6f3b20 (patch) | |
tree | 0e5f9df92b010b026cfab40a54a1778f55f93e61 /variable.c | |
parent | 887163beb8f27c5400cd04dbf98c474ed035526f (diff) |
Add an optional `inherit` argument to Module#autoload?
[Feature #15777]
Closes: https://github.com/ruby/ruby/pull/2173
Diffstat (limited to 'variable.c')
-rw-r--r-- | variable.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/variable.c b/variable.c index be0eee1df3..616c4852c0 100644 --- a/variable.c +++ b/variable.c @@ -2332,10 +2332,17 @@ rb_autoload_load(VALUE mod, ID id) VALUE rb_autoload_p(VALUE mod, ID id) { + return rb_autoload_at_p(mod, id, Qtrue); +} + +VALUE +rb_autoload_at_p(VALUE mod, ID id, VALUE recur) +{ VALUE load; struct autoload_data_i *ele; while (!autoload_defined_p(mod, id)) { + if (!RTEST(recur)) return Qnil; mod = RCLASS_SUPER(mod); if (!mod) return Qnil; } |