Module: Script::UI::PrintingSpinner
- Defined in:
- lib/project_types/script/ui/printing_spinner.rb
Class Method Summary collapse
-
.spin(ctx, title, auto_debrief: false) ⇒ Object
Creates a single spinner that runs the provided block.
Class Method Details
.spin(ctx, title, auto_debrief: false) ⇒ Object
Creates a single spinner that runs the provided block. The block can take in a ctx argument that formats printed output to support printing from within the spin block.
Attributes
-
ctx- The current context. -
title- Title of the spinner to use
Options
-
:auto_debrief- Automatically debrief exceptions? Default to true
Block
-
ctx- Instance of the PrintingSpinnerContext built from the ctx attribute.- +ctx.puts(...)+ formats output to enable support for printing within spinners -
spinner- Instance of the spinner. Can callupdate_titleto update the user of changes
27 28 29 30 31 32 |
# File 'lib/project_types/script/ui/printing_spinner.rb', line 27 def self.spin(ctx, title, auto_debrief: false) StrictSpinner.spin(title, auto_debrief: auto_debrief) do |spinner, *args| Thread.current[:cliui_output_hook] = nil yield(PrintingSpinnerContext.from(ctx, spinner), spinner, *args) end end |