Module: Sphyg

Defined in:
lib/sphyg.rb,
lib/sphyg/pulse.rb,
lib/sphyg/version.rb,
lib/sphyg/throbber.rb,
lib/sphyg/enumerators/base.rb,
lib/sphyg/enumerators/cycle.rb,
lib/sphyg/enumerators/rotate.rb

Overview

Top-level namespace

Defined Under Namespace

Modules: Enumerators Classes: Pulse, Throbber

Constant Summary collapse

THROBBERS =
{
  ascii: {
    enumerator: '::Sphyg::Enumerators::Cycle',
    frames: %w[| / - \\],
    rate: 0.1
  },
  elipsis: {
    enumerator: '::Sphyg::Enumerators::Cycle',
    frames: %w[. .. ... ..],
    rate: 0.2
  },
  heart: {
    enumerator: '::Sphyg::Enumerators::Cycle',
    frames: %w[🧑 πŸ’› πŸ’š πŸ’™ πŸ’œ],
    rate: 0.1
  },
  heroku: {
    enumerator: '::Sphyg::Enumerators::Cycle',
    frames: %w[⣾ ⣽ ⣻ Ⓙ ⑿ ⣟ ⣯ ⣷],
    rate: 0.1
  },
  moon: {
    enumerator: '::Sphyg::Enumerators::Cycle',
    frames: %w[πŸŒ‘ πŸŒ’ πŸŒ“ πŸŒ” πŸŒ• πŸŒ– πŸŒ— 🌘],
    rate: 0.2
  },
  time: {
    enumerator: '::Sphyg::Enumerators::Cycle',
    frames: %w[πŸ•› πŸ• πŸ•’ πŸ•“ πŸ•” πŸ•• πŸ•– πŸ•— πŸ•˜ πŸ•™ πŸ•š],
    rate: 1
  },
  wave: {
    enumerator: '::Sphyg::Enumerators::Rotate',
    frames: %w[β‘€ β „ β ‚ ⠁ β ‚ β „],
    rate: 0.1
  }
}.freeze
VERSION =
'0.3.1'.freeze

Class Method Summary collapse

Class Method Details

.pulse(message, options = nil, &blk) ⇒ Object

Presents a message and throbber Params:

message

friendly string to display that indicates a command is running

for example, 'Please wait'
options

configuration hash

&blk

a block containing a long-running command to run while displaying

the message and throbber


51
52
53
# File 'lib/sphyg.rb', line 51

def self.pulse(message, options = nil, &blk)
  ::Sphyg::Pulse.new(message, options).run { yield blk }
end