Class: Conditions::Before

Inherits:
ScheduleCondition show all
Defined in:
lib/triggerable/conditions/schedule/before.rb

Instance Method Summary collapse

Methods inherited from ScheduleCondition

#initialize, #scope, #true_for?

Methods inherited from FieldCondition

#initialize, #scope, #true_for?

Methods inherited from Condition

build, #scope, #true_for?

Constructor Details

This class inherits a constructor from Conditions::ScheduleCondition

Instance Method Details

#fromObject



3
4
5
6
7
8
9
10
11
12
# File 'lib/triggerable/conditions/schedule/before.rb', line 3

def from
  case @math_condition
  when :greater_than
    Time.now
  when :less_than
    Time.now + @value
  when nil
    automation_time + @value
  end
end

#toObject



14
15
16
17
18
19
20
21
# File 'lib/triggerable/conditions/schedule/before.rb', line 14

def to
  case @math_condition
  when :greater_than
    Time.now + @value
  when nil
    automation_time + @value + Engine.interval
  end
end