Revision
632
Author
lsansonetti@apple.com
Date
2008-09-27 18:34:59 -0700 (Sat, 27 Sep 2008)

Log Message

fixed Module::class

Modified Paths

Diff

Modified: MacRuby/trunk/objc.m (631 => 632)


--- MacRuby/trunk/objc.m	2008-09-27 04:43:26 UTC (rev 631)
+++ MacRuby/trunk/objc.m	2008-09-28 01:34:59 UTC (rev 632)
@@ -1133,7 +1133,7 @@
     else if (sel == @selector(class)) {
 	if (RCLASS_META(klass)) {
 	    /* because +[NSObject class] returns self */
-	    return rb_cClass;
+	    return RCLASS_MODULE(recv) ? rb_cModule : rb_cClass;
 	}
 	/* because the CF classes should be hidden */
 	else if (klass == rb_cCFString) {

Modified: MacRuby/trunk/test/ruby/test_objc.rb (631 => 632)


--- MacRuby/trunk/test/ruby/test_objc.rb	2008-09-27 04:43:26 UTC (rev 631)
+++ MacRuby/trunk/test/ruby/test_objc.rb	2008-09-28 01:34:59 UTC (rev 632)
@@ -405,4 +405,11 @@
     o = TestCallSuperOverridenNew.new(42)
     assert_equal(42, o.x)
   end
+
+  def test_class_on_mods
+    assert_equal(Class, Object.class)
+    assert_equal(Module, Kernel.class)
+    assert_equal(Class, Class.new.class)
+    assert_equal(Module, Module.new.class)
+  end  
 end