Why does bitwise OR return a boolean here. Of all the operators, I would least expect that from bitwise ones.
nil | 5 # => true
nil | 0 # => true
nil | true # => true
nil | false # => false
nil | nil # => false
Why does bitwise OR return a boolean here. Of all the operators, I would least expect that from bitwise ones.
nil | 5 # => true
nil | 0 # => true
nil | true # => true
nil | false # => false
nil | nil # => false
Found an answer in the same topic :)
Turns out that NilClass#| is overridden:
false | obj → true or false
nil | obj → true or false
Or—Returns false if obj is nil or false; true otherwise.