Project

spinner

0.0
No commit activity in last 3 years
No release in over 3 years
Display an animated spinner on the console during long-running processes in your app, with a percentage completed.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

Spinner

Display a spinning text widget during a long-running process in your app

Basic use

Call Spinner::with_spinner, and pass it a block:

Spinner::with_spinner do |spin|
    30.times do
        sleep 0.1
        spin.call
    end
end

Each time you call spin.call in the block, it will animate the spinner.

Advanced use

You can specify the message it displays, and cause it to display a percentage of completion, by passing a couple options:

Spinner::with_spinner(:count=>1000, :message=>"Processing files...") do |spin|
    1000.times do |file|
        # ... do something ...
        spin.call
    end
end