[#68137] improve semantics of manpages — "Anthony J. Bentley" <anthony@...>
Hi,
1 message
2015/02/17
[#68144] Re: Future of test suites for Ruby — Anthony Crumley <anthony.crumley@...>
FYI...
4 messages
2015/02/17
[#68343] [Ruby trunk - Bug #10916] [Open] What the Ruby? SegFault? — ruby@...
Issue #10916 has been reported by why do i need this acct just to create a bug report.
5 messages
2015/02/27
[#68373] Re: [Ruby trunk - Bug #10916] [Open] What the Ruby? SegFault?
— "Martin J. Dürst" <duerst@...>
2015/03/02
> * Author: why do i need this acct just to create a bug report
[#68358] [Ruby trunk - Bug #10902] require("enumerator") scans LOAD_PATH 2x on every invocation — ruby@...1.net
Issue #10902 has been updated by Aman Gupta.
3 messages
2015/02/28
[ruby-core:67943] [ruby-trunk - Feature #10017] [Assigned] Add `Hash#values_at!`
From:
nobu@...
Date:
2015-02-02 04:29:19 UTC
List:
ruby-core #67943
Issue #10017 has been updated by Nobuyoshi Nakada.
Status changed from Open to Assigned
Assignee set to Yukihiro Matsumoto
Matz, can we introduce this `Hash#fetch_values`?
----------------------------------------
Feature #10017: Add `Hash#values_at!`
https://bugs.ruby-lang.org/issues/10017#change-51332
* Author: Wojtek Mach
* Status: Assigned
* Priority: Normal
* Assignee: Yukihiro Matsumoto
----------------------------------------
I'm proposing to add a new method `Hash#values_at!` that's basically a combination of `#values_at` and `#fetch`.
When dealing with configuration I prefer to use `#fetch` to fail early and this would be useful to read multiple keys at a time.
An example (not strictly on a Hash, but you get the idea) could be:
```ruby
repo, token = ENV.values_at!('GITHUB_REPO', 'GITHUB_TOKEN')
ENV.values_at!('INVALID') # raises KeyError
# not sure if that useful, but I provide it here for the sake of completeness
ENV.values_at!("SHELL", "INVALID") { |k| k + " is missing" } # => ["/bin/bash", "INVALID is missing"]
```
Another name for this could be `#fetch_at`, perhaps.
P.S. I'm attaching a patch that was done using mostly trial and error
---Files--------------------------------
values_at_bang.patch (1.53 KB)
fetch_at.patch (2.18 KB)
--
https://bugs.ruby-lang.org/