[macruby-changes] [2216] MacRuby/branches/experimental/io.c

source_changes at macosforge.org source_changes at macosforge.org
Tue Aug 4 22:44:43 PDT 2009


Revision: 2216
          http://trac.macosforge.org/projects/ruby/changeset/2216
Author:   lsansonetti at apple.com
Date:     2009-08-04 22:44:43 -0700 (Tue, 04 Aug 2009)
Log Message:
-----------
raise a warning if IO.new is called with a block (to conform to rubyspec)

Modified Paths:
--------------
    MacRuby/branches/experimental/io.c

Modified: MacRuby/branches/experimental/io.c
===================================================================
--- MacRuby/branches/experimental/io.c	2009-08-05 05:44:12 UTC (rev 2215)
+++ MacRuby/branches/experimental/io.c	2009-08-05 05:44:43 UTC (rev 2216)
@@ -2969,6 +2969,12 @@
 static VALUE
 rb_io_s_new(VALUE klass, SEL sel, int argc, VALUE *argv)
 {
+    if (rb_block_given_p()) {
+	const char *cname = rb_class2name(klass);
+
+	rb_warn("%s::new() does not take block; use %s::open() instead",
+		cname, cname);
+    }
     return rb_class_new_instance(argc, argv, klass);
 }
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090804/90a69501/attachment.html>


More information about the macruby-changes mailing list