[#75687] [Ruby trunk Bug#12416] struct rb_id_table lacks mark function — shyouhei@...
Issue #12416 has been reported by Shyouhei Urabe.
3 messages
2016/05/23
[#75763] [Ruby trunk Feature#12435] Using connect_nonblock to open TCP connections in Net::HTTP#connect — mohamed.m.m.hafez@...
Issue #12435 has been reported by Mohamed Hafez.
3 messages
2016/05/28
[#75774] Errno::EAGAIN thrown by OpenSSL::SSL::SSLSocket#connect_nonblock — Mohamed Hafez <mohamed.m.m.hafez@...>
Hi all, every now and then in my production server, I'm
4 messages
2016/05/30
[#75775] Re: Errno::EAGAIN thrown by OpenSSL::SSL::SSLSocket#connect_nonblock
— Mohamed Hafez <mohamed.m.m.hafez@...>
2016/05/30
Or does MRI's OpenSSL::SSL::SSLSocket#connect_nonblock just return
[#75782] Important: Somewhat backwards-incompatible change (Fwd: [ruby-cvs:62388] duerst:r55225 (trunk): * string.c: Activate full Unicode case mapping for UTF-8) — Martin J. Dürst <duerst@...>
With the change below, I have activated full Unicode case mapping for
4 messages
2016/05/31
[ruby-core:75370] [Ruby trunk Feature#12350] Introduce Array#find! that raises an error if element not found
From:
nobu@...
Date:
2016-05-05 14:25:08 UTC
List:
ruby-core #75370
Issue #12350 has been updated by Nobuyoshi Nakada.
Victor Shepelev wrote:
> > Could you elaborate what is bad in your example? Basically I don't see anything bad in your code except a little bit verbose like in mine solution.
>
> I don't know! The most popular and widely accepted Ruby Style Guide just bans them: https://github.com/bbatsov/ruby-style-guide#no-and-or-or
I don't think it makes a sense, however, you can use `||` instead if you don't like `or` of course.
```ruby
prices.find { |p| p.key == size } || raise "Price for #{size} not found"
```
And it feels better to me because of the error message.
----------------------------------------
Feature #12350: Introduce Array#find! that raises an error if element not found
https://bugs.ruby-lang.org/issues/12350#change-58495
* Author: Andrey Koleshko
* Status: Open
* Priority: Normal
* Assignee:
----------------------------------------
It would be great to have some function (like `Hash#fetch`) for `Array` that raises an exception if element not found by passed block in `find`.
For example:
~~~
[].find! { |el| el == 1 }
=> ElementError: element not found
~~~
I just noticed that there are many cases when it's needed to raise an exception (because this is exceptional situation) if an element not found.
Currently I just define methods like this one:
~~~
def find_price!(size)
found_price = prices.find { |p| p.key == size }
fail "Price for #{size} not found" unless found_price
found_price
end
~~~
--
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>