Method: CLI::UI::Spinner::Async#initialize

Defined in:
lib/cli/ui/spinner/async.rb

#initialize(title) ⇒ Async

Returns a new instance of Async.



33
34
35
36
37
38
39
40
# File 'lib/cli/ui/spinner/async.rb', line 33

def initialize(title)
  require 'thread'
  sg = CLI::UI::Spinner::SpinGroup.new
  @m = Mutex.new
  @cv = ConditionVariable.new
  sg.add(title) { @m.synchronize { @cv.wait(@m) } }
  @t = Thread.new { sg.wait }
end