Class: Searchgasm::Condition::NotEqual

Inherits:
Base
  • Object
show all
Defined in:
lib/searchgasm/condition/not_equal.rb

Instance Attribute Summary

Attributes inherited from Base

#column, #column_for_type_cast, #column_sql, #column_sql_format, #klass, #table_name

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

condition_names_for_model, condition_type_name, #explicitly_set_value=, #explicitly_set_value?, handle_array_value?, ignore_meaningless_value?, #initialize, join_arrays_with_or?, #options, #sanitize, #value, #value=, #value_is_meaningless?

Constructor Details

This class inherits a constructor from Searchgasm::Condition::Base

Class Method Details

.condition_names_for_columnObject



8
9
10
# File 'lib/searchgasm/condition/not_equal.rb', line 8

def condition_names_for_column
  super + ["does_not_equal", "not_equal", "is_not", "not"]
end

Instance Method Details

#to_conditions(value) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/searchgasm/condition/not_equal.rb', line 13

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