summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
Diffstat (limited to 'array.c')
-rw-r--r--array.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/array.c b/array.c
index 45713c55b0..ff77a3ed94 100644
--- a/array.c
+++ b/array.c
@@ -3904,7 +3904,9 @@ ary_add_hash(VALUE hash, VALUE ary)
for (i=0; i<RARRAY_LEN(ary); i++) {
VALUE elt = RARRAY_AREF(ary, i);
- rb_hash_aset(hash, elt, elt);
+ if (rb_hash_lookup2(hash, elt, Qundef) == Qundef) {
+ rb_hash_aset(hash, elt, elt);
+ }
}
return hash;
}