Common Code:
class ThingA end
class ThingB end
class ThingC end
In order to set up conditional checks for the above types, I used the basic "if !..." construct that produced the accurate results as expected.
Sample Code if ! ...:
obj = ThingA.new
puts 'yes it is a ThingC' if !obj.is_a?(ThingA) && !obj.is_a?(ThingB) # works ok
# stdout => nothing
obj = ThingB.new
puts 'yes it is a ThingC' if !obj.is_a?(ThingA) && !obj.is_a?(ThingB) # works ok
# stdout => nothing
obj = ThingC.new
puts 'yes it is a ThingC' if !obj.is_a?(ThingA) && !obj.is_a?(ThingB) # works ok
# stdout => yes it is a ThingC
Considering the fact that "unless" is a more descriptive alternative to the basic "if !..." construct, I implemented the above using "unless", instead.
Sample Code unless:
obj = ThingA.new
puts 'yes it is a ThingC' unless obj.is_a?(ThingA) && obj.is_a?(ThingB) # BUG
# stdout => yes it is a ThingC
obj = ThingB.new
puts 'yes it is a ThingC' unless obj.is_a?(ThingA) && obj.is_a?(ThingB) # BUG
# stdout => yes it is a ThingC
obj = ThingC.new
puts 'yes it is a ThingC' unless obj.is_a?(ThingA) && obj.is_a?(ThingB) # ???
# stdout => yes it is a ThingC
Evidently, the "unless" version fails to produce the identical accurate results.
Based upon these simple and straight-forward results, would it be hard for anyone to conclude that "multiple conditions are not handled by unless accurately"?