Class: Conditions::Exists

Inherits:
FieldCondition show all
Defined in:
lib/triggerable/conditions/field/exists.rb

Instance Method Summary collapse

Methods inherited from FieldCondition

#initialize

Methods inherited from Condition

build

Constructor Details

This class inherits a constructor from Conditions::FieldCondition

Instance Method Details

#scopeObject



8
9
10
# File 'lib/triggerable/conditions/field/exists.rb', line 8

def scope
  "#{@field} IS #{'NOT ' if @value}NULL"
end

#true_for?(object) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
6
# File 'lib/triggerable/conditions/field/exists.rb', line 3

def true_for? object
  v = field_value(object)
  @value ? v.present? : v.blank?
end