Sha256: 4b8b4bd8851c341da456345dded9291daa5a85bdca30e8b82bcc6f6bbbaa2635

Contents?: true

Size: 466 Bytes

Versions: 1

Compression:

Stored size: 466 Bytes

Contents

module FilterParam
  module Operators
    class NotEqual < FieldFilterOperator
      operator_tag :ne

      def self.sql(field, literal)
        return "#{field.actual_name} IS NOT NULL" if literal.value.nil?

        "#{field.actual_name} != #{sql_quote(literal.value)}"
      end

      def self.negated_sql(field, literal)
        Operators::Equal.sql(field, literal)
      end
    end
  end
end

FilterParam::Operator.register(FilterParam::Operators::NotEqual)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
filter_param-0.1.2 lib/filter_param/operators/not_equal.rb