diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-04-26 23:47:55 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-04-26 23:47:55 +0900 |
| commit | a5161e76ed47965b71f6d84e88057d18e14da578 (patch) | |
| tree | a5005e89a0552282c20f32142fd927b7a07f047d /src/variable.c | |
| parent | 5bf327497fad0b30475649190626b8646b613bb4 (diff) | |
| download | mruby-a5161e76ed47965b71f6d84e88057d18e14da578.tar.gz mruby-a5161e76ed47965b71f6d84e88057d18e14da578.zip | |
Class.constants to take optional argument; close #2133
Diffstat (limited to 'src/variable.c')
| -rw-r--r-- | src/variable.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/variable.c b/src/variable.c index 90f0831da..231697d47 100644 --- a/src/variable.c +++ b/src/variable.c @@ -970,13 +970,16 @@ mrb_value mrb_mod_constants(mrb_state *mrb, mrb_value mod) { mrb_value ary; + mrb_bool inherit = TRUE; struct RClass *c = mrb_class_ptr(mod); + mrb_get_args(mrb, "|b", &inherit); ary = mrb_ary_new(mrb); while (c) { if (c->iv) { iv_foreach(mrb, c->iv, const_i, &ary); } + if (!inherit) break; c = c->super; if (c == mrb->object_class) break; } |
