ruby-changes:33698
From: nobu <ko1@a...>
Date: Fri, 2 May 2014 10:34:49 +0900 (JST)
Subject: [ruby-changes:33698] nobu:r45779 (trunk): symbol/type.c: bug_static_p bug_dynamic_p
nobu 2014-05-02 10:34:41 +0900 (Fri, 02 May 2014) New Revision: 45779 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45779 Log: 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. Modified files: trunk/ext/-test-/symbol/type.c Index: ext/-test-/symbol/type.c =================================================================== --- ext/-test-/symbol/type.c (revision 45778) +++ ext/-test-/symbol/type.c (revision 45779) @@ -41,10 +41,24 @@ bug_id2str(VALUE self, VALUE sym) https://github.com/ruby/ruby/blob/trunk/ext/-test-/symbol/type.c#L41 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); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/