unless types.any? ^ block
Turns out it's an exclusive or operator.
{giles-computer:giles} [05-24 21:59] ~
! irb
>> true ^ false
=> true
>> true ^ true
=> false
>> false ^ false
=> false
>> exit
{giles-computer:giles} [05-24 22:00] ~
!
the crack of doom on the hydrogen jukebox
{giles-computer:giles} [05-24 21:59] ~
! irb
>> true ^ false
=> true
>> true ^ true
=> false
>> false ^ false
=> false
>> exit
{giles-computer:giles} [05-24 22:00] ~
!
and c, c++, perl, verilog...
ReplyDelete:)
http://en.wikipedia.org/wiki/Bitwise_operation#XOR
yeah, embarassing really.
ReplyDeleteWell, it's a binary XOR on booleans, a bitwise XOR on numbers and a set XOR on sets.
ReplyDeleteAnd if you want it to mean something else, you can go ahead and define it on your own classes.
Yay ruby!
Caveat: you can go ahead and define it, but as far as I can tell, you still have to define it to take an arg.
ReplyDelete