The only two objects that evaluate to false-ish in a boolean context in Ruby are nil , a single instance of NilClass and false , a single instance of FalseClass . Every other object evaluates the true value.
If you want the else branch to be accepted, then myproxy should evaluate to nil or false .
If you want something logical, that you have actual control, you can try the case expression and redefine the case subquery operator MyProxy#=== .
source share