ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: burdettelamar@yahoo.com
To: ruby-core@ruby-lang.org
Subject: [ruby-core:95161] [Ruby master Misc#16192] ENV.update hash values ignored when block given
Date: Mon, 30 Sep 2019 22:12:29 +0000 (UTC)	[thread overview]
Message-ID: <redmine.issue-16192.20190930221227.a15bfe98c80f9f1c@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-16192.20190930221227@ruby-lang.org

Issue #16192 has been reported by burdettelamar@yahoo.com (Burdette Lamar).

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

* 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/

       reply	other threads:[~2019-09-30 22:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-16192.20190930221227@ruby-lang.org>
2019-09-30 22:12 ` burdettelamar [this message]
2019-09-30 23:18 ` [ruby-core:95163] [Ruby master Misc#16192] ENV.update hash values ignored when block given shevegen
2019-10-01  3:24 ` [ruby-core:95165] " nobu
2019-11-30 17:18 ` [ruby-core:96038] [Ruby master Bug#16192] " eregontp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.issue-16192.20190930221227.a15bfe98c80f9f1c@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).