Sha256: 44dbe04e8a9556dcc2aca7c19a191f25121fc1cc91ce313c8c33867b40c2f020

Contents?: true

Size: 796 Bytes

Versions: 3

Compression:

Stored size: 796 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
        
        conditions_array = condition.sanitize
        conditions_array.first.gsub!(/ IS /, " IS NOT ")
        conditions_array.first.gsub!(/ BETWEEN /, " NOT BETWEEN ")
        conditions_array.first.gsub!(/ IN /, " NOT IN ")
        conditions_array.first.gsub!(/=/, "!=")
        conditions_array
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
searchgasm-1.3.3 lib/searchgasm/condition/not_equal.rb
searchgasm-1.3.4 lib/searchgasm/condition/not_equal.rb
searchgasm-1.3.5 lib/searchgasm/condition/not_equal.rb