Skip to content

Commit 7a6705f

Browse files
committed
Fix ENV.update implementation.
1 parent 9b8b857 commit 7a6705f

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ Bug fixes:
6565
* Removed "shadowing outer local variable" warning.
6666
* Fixed parameter conversion to `String` in ENV methods.
6767
* Fixed deprecation warning when `ENV.index` is called.
68+
* Fixed `ENV.udpate` implementation.
6869

6970
Compatibility:
7071

spec/tags/core/env/update_tags.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/main/ruby/truffleruby/core/env.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,11 +284,14 @@ def to_h
284284
end
285285

286286
def update(other)
287+
return self if equal?(other)
288+
other = Truffle::Type.rb_convert_type(other, Hash, :to_hash)
287289
if block_given?
288290
other.each { |k, v| self[k] = yield(k, lookup(k), v) }
289291
else
290292
other.each { |k, v| self[k] = v }
291293
end
294+
self
292295
end
293296

294297
def keep_if(&block)

0 commit comments

Comments
 (0)