Project

General

Profile

Actions

Bug #13044

closed

ruby unless bug with plural conditions

Bug #13044: ruby unless bug with plural conditions

Added by imran (Imran Ashraf) almost 9 years ago. Updated almost 9 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux]
[ruby-core:78690]

Description

I am working on an app where I need to process various data-items based upon different ruby types. While setting up conditonal-checks, I discovered that "unless" fails to handle plural conditions.

Please consider the following example:

class ThingA end class ThingB end class ThingC end # obj = ThingA.new # obj = ThingB.new obj = ThingC.new # puts 'yes it is a ThingC' unless obj.is_a?(ThingA) && obj.is_a?(ThingB) # BUG # puts 'yes it is a ThingC' if !obj.is_a?(ThingA) && !obj.is_a?(ThingB) # this works ok # works ok with singular condition unless obj.is_a?(ThingA) unless obj.is_a?(ThingB) puts 'yes it is a ThingC' end end 

Thanks.

Regards,
Imran

Actions

Also available in: PDF Atom