class CLI::Mastermind::UserInterface::AsyncSpinners
Implementation of CLI::UI::SpinGroup with that keeps track of the results from individual spinners.
Attributes
results[R]
Public Class Methods
new()
click to toggle source
Calls superclass method
# File lib/cli/mastermind/user_interface.rb, line 197 def initialize @results = {} super end
Public Instance Methods
await(title) { |spinner| ... }
click to toggle source
Waits for a block to execute while displaying a spinner.
@param title [String] the title to display
@yieldparam spinner [CLI::UI::Spinner]
# File lib/cli/mastermind/user_interface.rb, line 207 def await(title) @results[title] = nil add(title) do |spinner| catch(:success) do msg = catch(:fail) do @results[title] = yield spinner throw :success end puts msg CLI::UI::Spinner::TASK_FAILED end end end