Sha256: aad1f8a7a437ee999a3932f9021a88c4bfe2410b1f5763c540fbf15b3117cd5e

Contents?: true

Size: 613 Bytes

Versions: 1

Compression:

Stored size: 613 Bytes

Contents

$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)

require 'cli_spinnable'

module Cli
  extend CliSpinnable
end

# Close the block before reading from input.

# Good:
Cli.with_spinner do |cli|
  cli.print 'Downloading something'
  sleep 1
  cli.tick
end

print 'Enter name: '
name = gets.chomp

Cli.with_spinner do |cli|
  cli.print "Doing something with name #{name}"
  sleep 1
  cli.tick
end

# Bad:
Cli.with_spinner do |cli|
  cli.print 'Downloading something'
  sleep 1
  cli.tick

  print 'Enter name: '
  name = gets.chomp

  cli.print "Doing something with name #{name}"
  sleep 1
  cli.tick
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cli_spinnable-0.2 examples/example3.rb