Class: Builtins::Countdown
Constant Summary
collapse
- USAGE_STRING =
"Usage: ops countdown <seconds>"
Constants inherited
from Builtin
Builtin::BUILTIN_DIR
Instance Attribute Summary
Attributes inherited from Builtin
#args, #config
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Builtin
class_for, #initialize
Constructor Details
This class inherits a constructor from Builtin
Class Method Details
.description ⇒ Object
10
11
12
|
# File 'lib/builtins/countdown.rb', line 10
def description
"Like `sleep`, but displays time remaining in terminal."
end
|
Instance Method Details
#run ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/builtins/countdown.rb', line 15
def run
check_args
timer_task.execute
while timer_task.running?
sleep(1)
timer_task.shutdown if task_complete?
end
Output.out("\rCountdown complete after #{sleep_seconds}s.")
true
end
|