From adc48831171828bca45f78de1606c6dbfcaddad6 Mon Sep 17 00:00:00 2001 From: Watson Date: Fri, 14 Jan 2011 08:37:53 +0000 Subject: [PATCH] Module#public_method_defined? will return true when was passed name/symbol of public method. Test Script: {{{ require 'test/unit/assertions.rb' include Test::Unit::Assertions class T def foo ; end def bar ; end def baz ; end protected :baz private :bar end assert_equal(true, T.public_method_defined?("foo")) assert_equal(true, T.public_method_defined?(:foo)) assert_equal(false, T.public_method_defined?("bar")) assert_equal(false, T.public_method_defined?(:bar)) assert_equal(false, T.public_method_defined?("baz")) assert_equal(false, T.public_method_defined?(:baz)) puts :ok }}} git-svn-id: http://svn.macosforge.org/repository/ruby/MacRuby/trunk@5165 23306eb0-4c56-4727-a40e-e92c0eb68959 --- vm_method.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vm_method.c b/vm_method.c index 85f03dcb2..29c7157d8 100644 --- a/vm_method.c +++ b/vm_method.c @@ -313,7 +313,7 @@ check_method_visibility(VALUE mod, ID id, int visi) rb_vm_method_node_t *node; if (rb_vm_lookup_method2((Class)mod, id, NULL, NULL, &node)) { if (node != NULL) { - if (node->flags & rb_vm_noex_flag(visi)) { + if ((node->flags & NOEX_MASK) == visi) { return Qtrue; } }