I’d like to suggest adding Object#presence! to ActiveSupport core extensions to give the option to easily accept only a value which is present? and otherwise raise an exception, much like Enumerable#sole either returns the sole value or raises.
This would typically help ensuring ensuring that a method doesn’t return a nil value in this fashion:
def compute_value
# ...
value.presence!
end
I’ve seen that changes to ActiveSupport core extensions are heavily discouraged but since there seem to be no plans to port Object#present? or Object#blank? to ruby, and that Object#presence will most likely keep being supported, I thought it was worth bringing up still.