Class: Triggerable::Conditions::NotIn
- Inherits:
-
FieldCondition
- Object
- Condition
- FieldCondition
- Triggerable::Conditions::NotIn
- Defined in:
- lib/triggerable/conditions/field/not_in.rb
Instance Method Summary collapse
- #desc ⇒ Object
-
#initialize(field, condition) ⇒ NotIn
constructor
A new instance of NotIn.
- #scope(table) ⇒ Object
- #true_for?(object) ⇒ Boolean
Methods inherited from Condition
Constructor Details
#initialize(field, condition) ⇒ NotIn
Returns a new instance of NotIn.
4 5 6 7 |
# File 'lib/triggerable/conditions/field/not_in.rb', line 4 def initialize field, condition super @db_comparator = 'not in' end |
Instance Method Details
#desc ⇒ Object
13 14 15 |
# File 'lib/triggerable/conditions/field/not_in.rb', line 13 def desc "#{@field} #{@db_comparator} #{@value}" end |
#scope(table) ⇒ Object
17 18 19 |
# File 'lib/triggerable/conditions/field/not_in.rb', line 17 def scope table Arel::Nodes::SqlLiteral.new("#{@field} #{@db_comparator} #{sanitized_value}") end |
#true_for?(object) ⇒ Boolean
9 10 11 |
# File 'lib/triggerable/conditions/field/not_in.rb', line 9 def true_for? object !@value.include?(field_value(object)) end |