Sha256: 41cfbef778922b836f61a5d8e82155780152b5c0b8e53eb5a005378ab052bd59
Contents?: true
Size: 458 Bytes
Versions: 3
Compression:
Stored size: 458 Bytes
Contents
module SpinR class Spinner def initialize(spinner = nil) @spinner = spinner || SpinR::Spinners::TRADITIONAL end def worker(&block) with_spin(&block) end private def with_spin chars = @spinner.clone.dup thread = Thread.new { yield } while thread.alive? print "#{chars[0]}\r" sleep 0.1 print "\b" chars.push chars.shift end thread.join end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
spin_r-0.1.0 | lib/spin_r/spinner.rb |
spin_r-0.0.2.beta | lib/spin_r/spinner.rb |
spin_r-0.0.1.beta | lib/spin_r/spinner.rb |