Module: Sequel::SQL::BitwiseMethods

Included in:
NumericExpression
Defined in:
lib/sequel_core/sql.rb

Overview

This defines the bitwise methods &, |, ^, ~, <<, and >>. Because these methods overlap with the standard BooleanMethods methods, and they only make sense for numbers, they are only included in NumericExpression.

Instance Method Summary collapse

Instance Method Details

#~Object

Do the bitwise compliment of the self



141
142
143
144
145
146
147
148
149
150
# File 'lib/sequel_core/sql.rb', line 141

def ~
  case self
  when NumericExpression 
    NumericExpression.new(:'B~', self)
  when ComplexExpression
    raise(Sequel::Error, "cannot apply #{o} to a non-numeric expression")
  else  
    NumericExpression.new(:'B~', self)
  end
end