Skip to content

randrews/spinner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Releases

No releases published

Packages

No packages published

Languages