[#86520] [Ruby trunk Bug#14681] `syswrite': stream closed in another thread (IOError) — samuel@...
Issue #14681 has been reported by ioquatix (Samuel Williams).
3 messages
2018/04/12
[#86755] [Ruby trunk Feature#14723] [WIP] sleepy GC — normalperson@...
Issue #14723 has been reported by normalperson (Eric Wong).
6 messages
2018/04/29
[ruby-core:86577] [Ruby trunk Feature#14672] Introduce a Date.safe_parse method
From:
coorasse@...
Date:
2018-04-18 10:11:24 UTC
List:
ruby-core #86577
Issue #14672 has been updated by coorasse (Alessandro Rodi).
As pointed out by @ahorek, is not really good to use, raise, catch exceptions in ruby because yes...they are slow.
A one line rescue is what I used in the past, but it feels hacky and is a catch-all rescue which is never a good approach.
In the end, rubocop now defines it as bad practice and corrects it automatically.
See also https://robots.thoughtbot.com/don-t-inline-rescue-in-ruby
----------------------------------------
Feature #14672: Introduce a Date.safe_parse method
https://bugs.ruby-lang.org/issues/14672#change-71519
* Author: coorasse (Alessandro Rodi)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
----------------------------------------
This feature request is about a Date.safe_parse method.
The method should call the original Date.parse method but avoid raising an exception and returning a fallback value instead.
An implementation in ActiveSupport has been proposed here: https://github.com/rails/rails/pull/32503/files.
This would avoid the necessity to rescue possible Exceptions everytime.
See:
```ruby
Date.safe_parse(nil)
=> # nil
Date.safe_parse("")
=> # nil
fallback = Date.new(2018,1,1)
Date.safe_parse(nil, fallback)
=> # #<Date: 2018-01-01>
```
--
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>