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.
129 130 131 132 |
# File 'lib/cli/mastermind/user_interface.rb', line 129 def initialize @results = {} super end |
Instance Attribute Details
#results ⇒ Object (readonly)
Returns the value of attribute results.
127 128 129 |
# File 'lib/cli/mastermind/user_interface.rb', line 127 def results @results end |
Instance Method Details
#await(title) ⇒ Object
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/cli/mastermind/user_interface.rb', line 134 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 |