Sha256: b98a0af73d3a878b6b0ba8b45c1b56e347a806ec1fa51abb3f555c6dc1f22521

Contents?: true

Size: 797 Bytes

Versions: 5

Compression:

Stored size: 797 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

5 entries across 5 versions & 1 rubygems

Version Path
searchgasm-1.4.0 lib/searchgasm/condition/not_equal.rb
searchgasm-1.5.0 lib/searchgasm/condition/not_equal.rb
searchgasm-1.5.1 lib/searchgasm/condition/not_equal.rb
searchgasm-1.4.1 lib/searchgasm/condition/not_equal.rb
searchgasm-1.5.2 lib/searchgasm/condition/not_equal.rb