Sha256: c48d15190445043755e7549bc96148e8339dae2c2cba84f9cd57c8ed214eb150

Contents?: true

Size: 694 Bytes

Versions: 3

Compression:

Stored size: 694 Bytes

Contents

module Searchgasm
  module Condition
    class NotEqual < Base
      self.handle_array_value = true
      self.ignore_meaningless_value = false
      
      class << self
        def condition_names_for_column
          super + ["does_not_equal", "not_equal", "is_not", "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

3 entries across 3 versions & 1 rubygems

Version Path
searchgasm-1.3.1 lib/searchgasm/condition/not_equal.rb
searchgasm-1.3.2 lib/searchgasm/condition/not_equal.rb
searchgasm-1.3.0 lib/searchgasm/condition/not_equal.rb