module Interact::Progress::Dots
Constants
- DOT_COUNT
- DOT_TICK
Public Class Methods
start!()
click to toggle source
# File lib/interact/progress.rb, line 12 def start! @dots ||= Thread.new do before_sync = $stdout.sync $stdout.sync = true printed = false i = 1 until @stop_dots if printed print "\b" * DOT_COUNT end print ("." * i).ljust(DOT_COUNT) printed = true if i == DOT_COUNT i = 0 else i += 1 end sleep DOT_TICK end if printed print "\b" * DOT_COUNT print " " * DOT_COUNT print "\b" * DOT_COUNT end $stdout.sync = before_sync @stop_dots = nil end end
stop!()
click to toggle source
# File lib/interact/progress.rb, line 49 def stop! return unless @dots return if @stop_dots @stop_dots = true @dots.join @dots = nil end