From: Nobuyoshi Nakada Date: 2009-02-21T04:09:45+09:00 Subject: Re: How to do conditional compile for Ruby 1.9 in a C extension? Hi, At Fri, 20 Feb 2009 18:58:55 +0900, Jason Garber wrote in [ruby-talk:328856]: > Sorry, nobu, I didn't follow you. Try again? Sorry, I misread the parentheses. > I'm working on updating RedCloth for Ruby 1.9. Since the output of > #singleton_methods changed from strings to symbols, I think I need a > conditional compile. Here's what I tried: It's a problem indeed. > #if RUBY_VERSION < 0x10900 > if (rb_ary_includes(rb_funcall(self, rb_intern("singleton_methods"), > 0), btype)) { > #else > if (rb_ary_includes(rb_funcall(self, rb_intern("singleton_methods"), > 0), rb_str_intern(btype))) { > #endif Do you really need to know only if singleton method is defined, not just self responds to it? We may have to add a new macro in ruby.h. -- Nobu Nakada