[macruby-changes] [2100] MacRuby/branches/experimental/hash.c
source_changes at macosforge.org
source_changes at macosforge.org
Mon Jul 27 15:40:33 PDT 2009
Revision: 2100
http://trac.macosforge.org/projects/ruby/changeset/2100
Author: lsansonetti at apple.com
Date: 2009-07-27 15:40:33 -0700 (Mon, 27 Jul 2009)
Log Message:
-----------
added support to delete environment variables using ENV[]=nil
Modified Paths:
--------------
MacRuby/branches/experimental/hash.c
Modified: MacRuby/branches/experimental/hash.c
===================================================================
--- MacRuby/branches/experimental/hash.c 2009-07-27 17:57:18 UTC (rev 2099)
+++ MacRuby/branches/experimental/hash.c 2009-07-27 22:40:33 UTC (rev 2100)
@@ -1815,16 +1815,19 @@
}
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);
name = RSTRING_PTR(nm);
value = RSTRING_PTR(val);
- if (strlen(name) != RSTRING_LEN(nm))
+ if (strlen(name) != RSTRING_LEN(nm)) {
rb_raise(rb_eArgError, "bad environment variable name");
- if (strlen(value) != RSTRING_LEN(val))
+ }
+ if (strlen(value) != RSTRING_LEN(val)) {
rb_raise(rb_eArgError, "bad environment variable value");
+ }
ruby_setenv(name, value);
#ifdef ENV_IGNORECASE
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090727/debb63c2/attachment.html>
More information about the macruby-changes
mailing list