Sha256: d84512bf1eb1860dc6dc400ff6734a2b9e9b1326e4486364017282ce0f18747c

Contents?: true

Size: 537 Bytes

Versions: 1

Compression:

Stored size: 537 Bytes

Contents

module Collimator

  module Spinner
    @spinning = nil
    @icons = ['-', '\\', '|', '/']

    def self.spin
      @spinning = Thread.new(@icons) do |myIcons|
        i = 0
        while true do
          print myIcons[i]
          STDOUT.flush
          if i == myIcons.length - 1
            i = 0
          else
            i += 1
          end
          sleep 0.1

          print "\b"
          STDOUT.flush
        end
      end
    end

    def self.stop
      @spinning.exit
      print "\b"
      STDOUT.flush
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
collimator-0.0.3 lib/collimator/spinner.rb