diff options
| author | dearblue <[email protected]> | 2018-09-08 10:06:09 +0900 |
|---|---|---|
| committer | dearblue <[email protected]> | 2018-09-08 10:25:30 +0900 |
| commit | 292ea06d4d10ca12ec931c73f0ca39db23d66b8e (patch) | |
| tree | 1b4f2425ec7c5c58a2c4e0458953501986fdfc1c | |
| parent | 3447162a4c5f1e5e7a1206deaacd8cb6ad2d3897 (diff) | |
| download | mruby-292ea06d4d10ca12ec931c73f0ca39db23d66b8e.tar.gz mruby-292ea06d4d10ca12ec931c73f0ca39db23d66b8e.zip | |
Fix outer module name
example:
a = Module.new
a::B = Module.new
p [a, a::B] # => [#<Module:0x801825890>, #<Class:0x801825890>::B]
# => [#<Module:0x801825890>, #<Module:0x801825890>::B] (Fixed)
| -rw-r--r-- | src/class.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/class.c b/src/class.c index 22fe36fb3..046090515 100644 --- a/src/class.c +++ b/src/class.c @@ -1701,7 +1701,8 @@ mrb_class_name(mrb_state *mrb, struct RClass* c) { mrb_value path = mrb_class_path(mrb, c); if (mrb_nil_p(path)) { - path = mrb_str_new_lit(mrb, "#<Class:"); + path = c->tt == MRB_TT_MODULE ? mrb_str_new_lit(mrb, "#<Module:") : + mrb_str_new_lit(mrb, "#<Class:"); mrb_str_concat(mrb, path, mrb_ptr_to_str(mrb, c)); mrb_str_cat_lit(mrb, path, ">"); } |
