Class: Kuroko2::Workflow::Task::Sleep
- Inherits:
-
Base
- Object
- Base
- Kuroko2::Workflow::Task::Sleep
show all
- Defined in:
- lib/autoload/kuroko2/workflow/task/sleep.rb
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
#execute ⇒ Object
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/autoload/kuroko2/workflow/task/sleep.rb', line 5
def execute
if (time = token.context['SLEEP'])
if Time.current.to_i > time
token.context.delete('SLEEP')
:next
else
:pass
end
else
token.context['SLEEP'] = Time.current.to_i + option.to_i
:pass
end
end
|
#validate ⇒ Object
21
22
23
24
25
|
# File 'lib/autoload/kuroko2/workflow/task/sleep.rb', line 21
def validate
unless /^\d+$/ === option
raise Workflow::AssertionError, "A value of sleep should be a number."
end
end
|