Class: CLI::Mastermind::UserInterface::AsyncSpinners
- Inherits:
-
UI::SpinGroup
- Object
- UI::SpinGroup
- CLI::Mastermind::UserInterface::AsyncSpinners
- Defined in:
- lib/cli/mastermind/user_interface.rb
Instance Attribute Summary collapse
-
#results ⇒ Object
readonly
Returns the value of attribute results.
Instance Method Summary collapse
- #await(title) ⇒ Object
-
#initialize ⇒ AsyncSpinners
constructor
A new instance of AsyncSpinners.
Constructor Details
#initialize ⇒ AsyncSpinners
Returns a new instance of AsyncSpinners.
142 143 144 145 |
# File 'lib/cli/mastermind/user_interface.rb', line 142 def initialize @results = {} super end |
Instance Attribute Details
#results ⇒ Object (readonly)
Returns the value of attribute results.
140 141 142 |
# File 'lib/cli/mastermind/user_interface.rb', line 140 def results @results end |
Instance Method Details
#await(title) ⇒ Object
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/cli/mastermind/user_interface.rb', line 147 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 |