Sha256: 415e010df1f6f4c9e725555505e0cb97502ac4a24dd764215a9ddb4b1efc0b4b
Contents?: true
Size: 947 Bytes
Versions: 2
Compression:
Stored size: 947 Bytes
Contents
module Dev module UI module Spinner class Async # Convenience method for +initialize+ # def self.start(title) new(title) end # Initializes a new asynchronous spinner with no specific end. # Must call +.stop+ to end the spinner # # ==== Attributes # # * +title+ - Title of the spinner to use # # ==== Example Usage: # # Dev::UI::Spinner::Async.new('Title') # def initialize(title) require 'thread' sg = Dev::UI::Spinner::SpinGroup.new @m = Mutex.new @cv = ConditionVariable.new sg.add(title) { @m.synchronize { @cv.wait(@m) } } @t = Thread.new { sg.wait } end # Stops an asynchronous spinner # def stop @m.synchronize { @cv.signal } @t.value end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dev-ui-0.1.2 | lib/dev/ui/spinner/async.rb |
dev-ui-0.1.1 | lib/dev/ui/spinner/async.rb |