Module: Interact::Progress
- Includes:
- Pretty
- Defined in:
- lib/interact/progress.rb
Defined Under Namespace
Modules: Dots Classes: Skipper
Constant Summary
Constants included from Pretty
Interact::Pretty::COLOR_CODES, Interact::Pretty::DEFAULT_COLORS, Interact::Pretty::WINDOWS
Instance Method Summary collapse
-
#quiet? ⇒ Boolean
override to determine whether to show progress.
- #with_progress(message) ⇒ Object
Instance Method Details
#quiet? ⇒ Boolean
override to determine whether to show progress
78 79 80 |
# File 'lib/interact/progress.rb', line 78 def quiet? false end |
#with_progress(message) ⇒ Object
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/interact/progress.rb', line 82 def with_progress() unless quiet? print Dots.start! end skipper = Skipper.new do |status, color, callback| unless quiet? Dots.stop! puts "... #{c(status, color)}" end return callback && callback.call end begin res = yield skipper unless quiet? Dots.stop! puts "... #{c("OK", :good)}" end res rescue unless quiet? Dots.stop! puts "... #{c("FAILED", :error)}" end raise end end |