[前][次][番号順一覧][スレッド一覧]

ruby-changes:7941

From: matz <ko1@a...>
Date: Tue, 23 Sep 2008 08:27:52 +0900 (JST)
Subject: [ruby-changes:7941] Ruby:r19463 (trunk): * hash.c (env_aset): allow nil value to remove an entry.

matz	2008-09-23 08:27:33 +0900 (Tue, 23 Sep 2008)

  New Revision: 19463

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=19463

  Log:
    * hash.c (env_aset): allow nil value to remove an entry.
      [ruby-dev:36465]

  Modified files:
    trunk/ChangeLog
    trunk/hash.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 19462)
+++ ChangeLog	(revision 19463)
@@ -1,3 +1,8 @@
+Tue Sep 23 08:25:56 2008  Yukihiro Matsumoto  <matz@r...>
+
+	* hash.c (env_aset): allow nil value to remove an entry.
+	  [ruby-dev:36465]
+
 Tue Sep 23 08:07:07 2008  Yukihiro Matsumoto  <matz@r...>
 
 	* misc/ruby-mode.el (ruby-keyword-end-re): emacs21 support.  a
Index: hash.c
===================================================================
--- hash.c	(revision 19462)
+++ hash.c	(revision 19463)
@@ -2052,7 +2052,8 @@
     }
 
     if (NIL_P(val)) {
-	rb_raise(rb_eTypeError, "cannot assign nil; use Hash#delete instead");
+	env_delete(obj, nm);
+	return Qnil;
     }
     StringValue(nm);
     StringValue(val);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]