Module: CLI::UI::Spinner
- Defined in:
- lib/cli/ui/spinner.rb,
lib/cli/ui/spinner/async.rb,
lib/cli/ui/spinner/spin_group.rb
Defined Under Namespace
Constant Summary collapse
- PERIOD =
seconds
0.1
- TASK_FAILED =
:task_failed
Class Method Summary collapse
-
.spin(title, auto_debrief: true, &block) ⇒ Object
Adds a single spinner Uses an interactive session to allow the user to pick an answer Can use arrows, y/n, numbers (1/2), and vim bindings to control.
Class Method Details
.spin(title, auto_debrief: true, &block) ⇒ Object
Adds a single spinner Uses an interactive session to allow the user to pick an answer Can use arrows, y/n, numbers (1/2), and vim bindings to control
Attributes
-
title
- Title of the spinner to use
Options
-
:auto_debrief
- Automatically debrief exceptions? Default to true
Block
-
*spinner+ - Instance of the spinner. Can call
update_title
to update the user of changes
Example Usage:
CLI::UI::Spinner.spin('Title') { sleep 1.0 }
41 42 43 44 45 |
# File 'lib/cli/ui/spinner.rb', line 41 def self.spin(title, auto_debrief: true, &block) sg = SpinGroup.new(auto_debrief: auto_debrief) sg.add(title, &block) sg.wait end |