Currently the convention is for methods ending in ?
to return a boolean value. Often this method is used at the beginning of a ternary operator, e.g. protocol = request.ssl? ? 'https' : 'http'
.
The proposed would be to allow the ...?
method to accept two arguments, returning the first if the method would return true, the second if false. This may not follow the principal of least surprise, so another proposed alternative would be suffixing the method with ??
.
# The following are equivalent to
# `protocol = request.ssl? ? 'https' : 'http'`
protocol = request.ssl?('https', 'http')
# or
protocol = request.ssl??('https', 'http')