Method: Sequel::SQL::OperatorBuilders#~

Defined in:
lib/sequel/sql.rb

#~(arg) ⇒ Object

Invert the given expression. Returns a Sequel::SQL::BooleanExpression created from this argument, not matching all of the conditions.

Sequel.~(nil) # SQL: NOT NULL
Sequel.~([[:a, true]]) # SQL: a IS NOT TRUE
Sequel.~([[:a, 1], [:b, [2, 3]]]) # SQL: a != 1 OR b NOT IN (2, 3)


884
885
886
887
888
889
890
# File 'lib/sequel/sql.rb', line 884

def ~(arg)
  if condition_specifier?(arg)
    SQL::BooleanExpression.from_value_pairs(arg, :OR, true)
  else
    SQL::BooleanExpression.invert(arg)
  end
end