Sha256: de04bd935d474b36d98171c2b3fa9620be1b7a5306eaf4a185cf90b076eae3f2

Contents?: true

Size: 641 Bytes

Versions: 4

Compression:

Stored size: 641 Bytes

Contents

module Searchgasm
  module Condition
    class DoesNotEqual < Base
      self.ignore_blanks = 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

4 entries across 4 versions & 1 rubygems

Version Path
searchgasm-1.1.2 lib/searchgasm/condition/does_not_equal.rb
searchgasm-1.1.3 lib/searchgasm/condition/does_not_equal.rb
searchgasm-1.2.1 lib/searchgasm/condition/does_not_equal.rb
searchgasm-1.2.0 lib/searchgasm/condition/does_not_equal.rb