summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-02 01:34:41 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-02 01:34:41 +0000
commita80b30041671d2b97c205e50c29fb25f35a292f0 (patch)
tree11ee2e6a4fb17dfb9f1ef6da20510bcce6927d6f
parent0e7a25bd4e8fb8bbc2e3fb703c99054510824baf (diff)
symbol/type.c: bug_static_p bug_dynamic_p
* ext/-test-/symbol/type.c (bug_static_p, bug_dynamic_p): methods for debug, which predicate the given symbol type. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ext/-test-/symbol/type.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/ext/-test-/symbol/type.c b/ext/-test-/symbol/type.c
index 17f2d68..c6dbdd1 100644
--- a/ext/-test-/symbol/type.c
+++ b/ext/-test-/symbol/type.c
@@ -41,10 +41,24 @@ bug_id2str(VALUE self, VALUE sym)
return rb_id2str(SYM2ID(sym));
}
+static VALUE
+bug_static_p(VALUE self, VALUE sym)
+{
+ return STATIC_SYM_P(sym) ? Qtrue : Qfalse;
+}
+
+static VALUE
+bug_dynamic_p(VALUE self, VALUE sym)
+{
+ return DYNAMIC_SYM_P(sym) ? Qtrue : Qfalse;
+}
+
void
Init_type(VALUE klass)
{
FOREACH_ID_TYPES(declare_symbol_type_p);
rb_define_singleton_method(klass, "attrset", bug_sym_attrset, 1);
rb_define_singleton_method(klass, "id2str", bug_id2str, 1);
+ rb_define_singleton_method(klass, "static?", bug_static_p, 1);
+ rb_define_singleton_method(klass, "dynamic?", bug_dynamic_p, 1);
}