Sha256: 0eb019d74f66003002163c9cfde95eb4eba1328fc5f8bfdc9821ff6a45bea854

Contents?: true

Size: 788 Bytes

Versions: 1

Compression:

Stored size: 788 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, options)
        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

1 entries across 1 versions & 1 rubygems

Version Path
searchgasm-1.5.3 lib/searchgasm/condition/not_equal.rb