Module: Sequel::SQL::BitwiseMethods

Included in:
Postgres::InetOp, NumericExpression
Defined in:
lib/sequel/sql.rb

Overview

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

Sequel[:a].sql_number & :b # "a" & "b"
Sequel[:a].sql_number | :b # "a" | "b"
Sequel[:a].sql_number ^ :b # "a" ^ "b"
Sequel[:a].sql_number << :b # "a" << "b"
Sequel[:a].sql_number >> :b # "a" >> "b"
~Sequel[:a].sql_number # ~"a"

Instance Method Summary collapse

Instance Method Details

#~Object

Do the bitwise compliment of the self

~(Sequel[:a].sql_number) # ~"a"


283
284
285
# File 'lib/sequel/sql.rb', line 283

def ~
  NumericExpression.new(:'B~', self)
end