Skip to content

Commit 9d9390a

Browse files
Satoshi Tagomoritagomoris
authored andcommitted
Add methods for debugging only when RUBY_DEBUG
1 parent 6e9a341 commit 9d9390a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

namespace.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -826,6 +826,18 @@ Init_enable_namespace(void)
826826

827827
#ifdef RUBY_DEBUG
828828

829+
static VALUE
830+
rb_namespace_s_root(VALUE recv)
831+
{
832+
return root_namespace->ns_object;
833+
}
834+
835+
static VALUE
836+
rb_namespace_s_main(VALUE recv)
837+
{
838+
return main_namespace->ns_object;
839+
}
840+
829841
static const char *
830842
classname(VALUE klass)
831843
{
@@ -990,6 +1002,8 @@ Init_Namespace(void)
9901002
rb_include_module(rb_cObject, rb_mNamespaceLoader);
9911003

9921004
#ifdef RUBY_DEBUG
1005+
rb_define_singleton_method(rb_cNamespace, "root", rb_namespace_s_root, 0);
1006+
rb_define_singleton_method(rb_cNamespace, "main", rb_namespace_s_main, 0);
9931007
rb_define_global_function("dump_classext", rb_f_dump_classext, 1);
9941008
#endif
9951009
}

0 commit comments

Comments
 (0)