Thrift::Union violates the contract for the :== method, by assuming that the passed argument is either nil or a Thrift::Union (by calling methods that only exist on Thrift::Union). An extra clause should be put in to test if it is not a Union and fail.
Idiomatically, this should be done via duck typing making the method be:
nil && other.repond_to?(:get_set_field) && other.respond_to?(:get_value) && @setfield == other.get_set_field && @value == other.get_value