Not sure, but I think some variations with case-statement of this work, but this does not:
# considering a @io typed as TCPSocket | SSLSocket
if @io.is_a?(SSLSocket) && @io.verify_hostname(host)
# the last statement fails because `TCPSocket | SSLSocket` does not define verify_hostname, only the latter
Not sure, but I think some variations with case-statement of this work, but this does not: