| Module | Sequel::SQL::NoBooleanInputMethods |
| In: |
lib/sequel_core/sql.rb
|
This module augments the default initalize method for the ComplexExpression subclass it is included in, so that attempting to use boolean input when initializing a NumericExpression or StringExpression results in an error.
Raise an Error if one of the args would be boolean in an SQL context, otherwise call super.
# File lib/sequel_core/sql.rb, line 235
235: def initialize(op, *args)
236: args.each do |a|
237: case a
238: when BooleanExpression, TrueClass, FalseClass, NilClass, Hash, Array
239: raise(Error, "cannot apply #{op} to a boolean expression")
240: end
241: end
242: super
243: end