Method: Array#sql_expr

Defined in:
lib/sequel/extensions/core_extensions.rb

#sql_exprObject

Return a Sequel::SQL::BooleanExpression created from this array, matching all of the conditions. Rarely do you need to call this explicitly, as Sequel generally assumes that arrays of two element arrays specify this type of condition. One case where it can be necessary to use this is if you are using the object as a value in a filter hash and want to use the = operator instead of the IN operator (which is used by default for arrays of two element arrays).

[[:a, true]].sql_expr # SQL: a IS TRUE
[[:a, 1], [:b, [2, 3]]].sql_expr # SQL: a = 1 AND b IN (2, 3)


62
63
64
# File 'lib/sequel/extensions/core_extensions.rb', line 62

def sql_expr
  Sequel.expr(self)
end