Class: Builtins::Countdown
Constant Summary
collapse
- USAGE_STRING =
"Usage: ops countdown <seconds>"
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
13
14
15
|
# File 'lib/builtins/countdown.rb', line 13
def description
"Like `sleep`, but displays time remaining in terminal."
end
|
Instance Method Details
#run ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/builtins/countdown.rb', line 18
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.")
end
|