Class: BruteCLI::Spinner::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/brute_cli/spinner.rb

Overview

Abstract base class for CLI spinners.

Subclasses must implement:

#start     – begin the spinner animation
#stop      – halt the spinner animation
#spinning? – whether the spinner is currently animating

All spinners receive an output IO via the constructor so they write through the Terminal buffer rather than directly to $stdout.

Direct Known Subclasses

Dots, Nyan, PuffPuffPass

Instance Method Summary collapse

Constructor Details

#initialize(output: $stdout) ⇒ Base

Returns a new instance of Base.



16
17
18
# File 'lib/brute_cli/spinner.rb', line 16

def initialize(output: $stdout)
  @output = output
end

Instance Method Details

#spinning?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


28
29
30
# File 'lib/brute_cli/spinner.rb', line 28

def spinning?
  raise NotImplementedError, "#{self.class.name} must implement #spinning?"
end

#startObject

Raises:

  • (NotImplementedError)


20
21
22
# File 'lib/brute_cli/spinner.rb', line 20

def start
  raise NotImplementedError, "#{self.class.name} must implement #start"
end

#stopObject

Raises:

  • (NotImplementedError)


24
25
26
# File 'lib/brute_cli/spinner.rb', line 24

def stop
  raise NotImplementedError, "#{self.class.name} must implement #stop"
end