summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authorKenichi Kamiya <kachick1@gmail.com>2019-06-21 12:28:28 +0900
committerBenoit Daloze <eregontp@gmail.com>2019-06-21 18:25:01 +0200
commitd01fd821875b989affc36e54e98f5dd67f47062e (patch)
treee34d7777ea878d7a5cc78d3429b3014dcccdf937 /hash.c
parent3b2d11ad90fcb64b41acc9006dfd1e40b4bd9000 (diff)
Alias ENV.merge! as ENV.update
[Feature #15947] Closes: https://github.com/ruby/ruby/pull/2246
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/hash.c b/hash.c
index 2982afad9d..8af5be688e 100644
--- a/hash.c
+++ b/hash.c
@@ -5788,6 +5788,8 @@ env_update_i(VALUE key, VALUE val)
* call-seq:
* ENV.update(hash) -> Hash
* ENV.update(hash) { |name, old_value, new_value| block } -> Hash
+ * ENV.merge!(hash) -> Hash
+ * ENV.merge!(hash) { |name, old_value, new_value| block } -> Hash
*
* Adds the contents of +hash+ to the environment variables. If no block is
* specified entries with duplicate keys are overwritten, otherwise the value
@@ -6059,6 +6061,7 @@ Init_Hash(void)
rb_define_singleton_method(envtbl, "invert", env_invert, 0);
rb_define_singleton_method(envtbl, "replace", env_replace, 1);
rb_define_singleton_method(envtbl, "update", env_update, 1);
+ rb_define_singleton_method(envtbl, "merge!", env_update, 1);
rb_define_singleton_method(envtbl, "inspect", env_inspect, 0);
rb_define_singleton_method(envtbl, "rehash", env_none, 0);
rb_define_singleton_method(envtbl, "to_a", env_to_a, 0);