Issue #16192 has been updated by nobu (Nobuyoshi Nakada).

Description updated

I think this is a bug, for the same reason as [Bug #16173].

https://github.com/ruby/ruby/pull/2512

----------------------------------------
Misc #16192: ENV.update hash values ignored when block given
https://bugs.ruby-lang.org/issues/16192#change-81802

* Author: burdettelamar / yahoo.com (Burdette Lamar)
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
Doc:

```
update(hash) вк Hash
update(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 of each duplicate name is determined by calling the block with the key, its value from the environment and its value from the hash.

But:

The attached code shows that the block is called and its returned value assigned even if the name is not a duplicate.  So basically this means that when a block is given, the hash values are ignored for all keys.

I had expected that for a non-duplicate name, the block would be ignored, and the hash value assigned.

I'm calling this a Misc, and not a Bug, just in case I'm missing something.

---Files--------------------------------
t.rb (179 Bytes)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>