Skip to content

gtramontina/spinner-frames.cr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

spinner-frames.cr

A collection of spinner frames

spinner-frames


Installation

Add this to your application's shard.yml:

dependencies:
  spinner-frames:
    github: gtramontina/spinner-frames.cr
    version: <version>

Usage

First require it…

require "spinner-frames"

Then you can use the default charset (:line)…

s = SpinnerFrames.new
5.times { print s.next } # -\|/-

… any of the built-in charsets…

s = SpinnerFrames.new(SpinnerFrames::Charset[:arc])
5.times { print s.next } # ◜◠◝◞◡

… provide a new charset as String

s = SpinnerFrames.new("01234")
5.times { print s.next } # 01234

… or as Array(String)

s = SpinnerFrames.new(["[   ]", "[-  ]", "[ - ]", "[  -]", "[   ]"])
5.times { print s.next } # [   ][-  ][ - ][  -][   ]

Contributing

  1. Fork it ( https://github.com/gtramontina/spinner-frames.cr/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Related


travis build