Sha256: 9726362f1c33d774aa57bb90512a95f7300af972c5cedd2ab415b8c50f142b0d

Contents?: true

Size: 646 Bytes

Versions: 1

Compression:

Stored size: 646 Bytes

Contents

module Searchgasm
  module Condition
    class DoesNotEqual < Base
      self.ignore_meaningless = false
      
      class << self
        def aliases_for_column(column)
          ["#{column.name}_is_not", "#{column.name}_not"]
        end
      end
      
      def to_conditions(value)
        # Delegate to equals and then change
        condition = Equals.new(klass, column)
        condition.value = value
        
        sql = condition.sanitize
        sql.gsub!(/ IS /, " IS NOT ")
        sql.gsub!(/ BETWEEN /, " NOT BETWEEN ")
        sql.gsub!(/ IN /, " NOT IN ")
        sql.gsub!(/=/, "!=")
        sql
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
searchgasm-1.2.2 lib/searchgasm/condition/does_not_equal.rb