class Utils::Spinner

Public Class Methods

all() click to toggle source
# File lib/utils/processing_spinner.rb, line 18
def self.all
  ObjectSpace.each_object(self).to_a
end
new() click to toggle source
# File lib/utils/processing_spinner.rb, line 4
def initialize
  @wheel = ''
  @processing = false
end

Public Instance Methods

is_processing?() click to toggle source
# File lib/utils/processing_spinner.rb, line 22
def is_processing?
  @processing
end
start_processing() click to toggle source
# File lib/utils/processing_spinner.rb, line 9
def start_processing
  @wheel = %w{| / - \\}
  @processing = true
  while @processing do
    print "\b" + @wheel.rotate!.first
    sleep(0.1)
  end
end
stop_processing() click to toggle source
# File lib/utils/processing_spinner.rb, line 26
def stop_processing
  @wheel = ''
  @processing = false
end