class CC::Analyzer::Formatters::Spinner
Attributes
spinner[R]
Public Class Methods
new(text)
click to toggle source
# File lib/cc/analyzer/formatters/spinner.rb, line 5 def initialize(text) @spinner = TTY::Spinner.new(text) end
Public Instance Methods
start()
click to toggle source
# File lib/cc/analyzer/formatters/spinner.rb, line 9 def start return unless $stdout.tty? && !CLI.debug? @thread = Thread.new do loop do @spinning = true spinner.spin sleep 0.075 end end end
stop(text = "Done!")
click to toggle source
# File lib/cc/analyzer/formatters/spinner.rb, line 20 def stop(text = "Done!") if @spinning spinner.stop(text) print("\n") @thread.kill end @spinning = false end