Module: Jobshop::CLI::UI
Instance Method Summary collapse
Instance Method Details
#do_with_spinner(name, &block) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/jobshop/cli/spinner.rb', line 8 def do_with_spinner(name, &block) title = "[:spinner] #{name.ljust(40, '.')}" spinner = TTY::Spinner.new(title, format: :dots) spinner.auto_spin t1 = Time.now retval = yield t2 = Time.now delta = t2 - t1 spinner.success("done (#{delta}s)") retval end |