Skip to content

Commit

Permalink
Add example of starting multi spinner with async jobs in ref to issue #…
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrmurach committed Aug 6, 2017
1 parent fac2116 commit e658d78
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions examples/multi/jobs.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# encoding: utf-8

require 'tty-spinner'

spinners = TTY::Spinner::Multi.new("[:spinner] top")

spinners.register("[:spinner] one") { |sp| sleep(2); sp.success('yes 2') }
spinners.register("[:spinner] two") { |sp| sleep(3); sp.error('no 2') }
spinners.register("[:spinner] three") { |sp| sleep(1); sp.success('yes 3') }

spinners.auto_spin

0 comments on commit e658d78

Please sign in to comment.