[macruby-changes] [5165] MacRuby/trunk/vm_method.c

source_changes at macosforge.org source_changes at macosforge.org
Fri Jan 14 00:37:58 PST 2011


Revision: 5165
          http://trac.macosforge.org/projects/ruby/changeset/5165
Author:   watson1978 at gmail.com
Date:     2011-01-14 00:37:53 -0800 (Fri, 14 Jan 2011)
Log Message:
-----------
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
}}}

Modified Paths:
--------------
    MacRuby/trunk/vm_method.c

Modified: MacRuby/trunk/vm_method.c
===================================================================
--- MacRuby/trunk/vm_method.c	2011-01-14 06:20:10 UTC (rev 5164)
+++ MacRuby/trunk/vm_method.c	2011-01-14 08:37:53 UTC (rev 5165)
@@ -313,7 +313,7 @@
     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;
 	    }
 	}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20110114/74dba57e/attachment.html>


More information about the macruby-changes mailing list