Module Sequel::SQL::PatternMatchMethods
In: lib/sequel/sql.rb

This module includes methods for overriding the =~ method for SQL equality, inclusion, and pattern matching. It returns the same result that Sequel would return when using a hash with a single entry, where the receiver was the key and the argument was the value. Example:

  Sequel[:a] =~ 1 # (a = 1)
  Sequel[:a] =~ [1, 2] # (a IN [1, 2])
  Sequel[:a] =~ nil # (a IS NULL)

This also adds the !~ method, for easily setting up not equals, exclusion, and inverse pattern matching. This is the same as as inverting the result of the =~ method

  Sequel[:a] !~ 1 # (a != 1)
  Sequel[:a] !~ [1, 2] # (a NOT IN [1, 2])
  Sequel[:a] !~ nil # (a IS NOT NULL)

Methods

!~   =~  

Public Instance methods

[Source]

     # File lib/sequel/sql.rb, line 812
812:       def !~(other)
813:         ~(self =~ other)
814:       end

Set up an equality, inclusion, or pattern match operation, based on the type of the argument.

[Source]

     # File lib/sequel/sql.rb, line 808
808:       def =~(other)
809:         BooleanExpression.send(:from_value_pair, self, other)
810:       end

[Validate]