[#66678] [ruby-trunk - Feature #10481] Add "if" and "unless" clauses to rescue statements — alex@...
Issue #10481 has been updated by Alex Boyd.
3 messages
2014/12/04
[#66762] Re: [ruby-changes:36667] normal:r48748 (trunk): struct: avoid all O(n) behavior on access — Tanaka Akira <akr@...>
2014-12-10 0:44 GMT+09:00 normal <ko1@atdot.net>:
3 messages
2014/12/10
[#66851] [ruby-trunk - Feature #10585] struct: speedup struct.attr = v for first 10 attributes and struct[:attr] for big structs — funny.falcon@...
Issue #10585 has been updated by Yura Sokolov.
3 messages
2014/12/15
[#67126] Ruby 2.2.0 Released — "NARUSE, Yui" <naruse@...>
We are pleased to announce the release of Ruby 2.2.0.
8 messages
2014/12/25
[#67128] Re: Ruby 2.2.0 Released
— Rodrigo Rosenfeld Rosas <rr.rosas@...>
2014/12/25
I can't install it in any of our Ubuntu servers using rbenv:
[#67129] Re: Ruby 2.2.0 Released
— SHIBATA Hiroshi <shibata.hiroshi@...>
2014/12/25
> I can't install it in any of our Ubuntu servers using rbenv:
[ruby-core:66663] [ruby-trunk - Feature #10017] Add `Hash#values_at!`
From:
wojtek@...
Date:
2014-12-03 21:49:34 UTC
List:
ruby-core #66663
Issue #10017 has been updated by Wojtek Mach.
I submitted PR for this change: https://github.com/ruby/ruby/pull/776 calling the method `fetch_values`.
----------------------------------------
Feature #10017: Add `Hash#values_at!`
https://bugs.ruby-lang.org/issues/10017#change-50272
* Author: Wojtek Mach
* Status: Open
* Priority: Normal
* Assignee:
* Category:
* Target version:
----------------------------------------
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/