summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-22 23:27:33 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-22 23:27:33 +0000
commit3256a4dc214610884c0eb1e72b0d12242536d7e5 (patch)
tree254c4bf0b241f4a0f575bee5353f7b457a78c617 /hash.c
parentfb014572650bc333c3c4ffe6b1179d443b7f03c3 (diff)
* hash.c (env_aset): allow nil value to remove an entry.
[ruby-dev:36465] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/hash.c b/hash.c
index 694b619529..bc627d868f 100644
--- a/hash.c
+++ b/hash.c
@@ -2052,7 +2052,8 @@ env_aset(VALUE obj, VALUE nm, VALUE val)
}
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);