3 ms·
For me the most useful bit about #fetch is not that it throws, it's that it allows setting a default value while distinguishing between a missing key and a key
by lloeki 3y ago
For me the most useful bit about #fetch is not that it throws, it's that it allows setting a default value while distinguishing between a missing key and a key with nil as a value. If I want to handle key presence without a default I just use #key? as exceptions come with additional performance cost (building the stacktrace)