Add Time::Location.load?#16121
Conversation
| # Raises `InvalidTZDataError` if the loader encounters a format error in the | ||
| # time zone database. | ||
| # | ||
| # - `.load` raises if the location is unavailable. |
There was a problem hiding this comment.
It's weird to get a bullet point about the behavior of another, alternative method, without any introduction to why we talk about it. For example "Consider X instead to raise when the location is unavailable" (same remark for .load).
There was a problem hiding this comment.
We use the same format in many other doc comments. I suppose we could introduce the list with "See also:"? But it feels odd to do this only a single instance. We should update the existing documentation as well, which makes it a different change.
There was a problem hiding this comment.
The :ditto: includes the entire doc comment for .load, by the way
There was a problem hiding this comment.
I know. It seems bad to duplicate the entire documentation, either. 😢
This is a convenience method that returns
nilif a location name doesn't exist.This makes it possible to implement a fallback without a raise/rescue trip:
Time::Location.load?("Asia/Jerusalem") || Time::Location.load?("Asia/Tel_Aviv").