Class: Kontena::Cli::SpinnerStatus
- Inherits:
-
Object
- Object
- Kontena::Cli::SpinnerStatus
- Defined in:
- lib/kontena/cli/spinner.rb
Instance Attribute Summary collapse
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#thread ⇒ Object
readonly
Returns the value of attribute thread.
Instance Method Summary collapse
- #fail ⇒ Object
- #fail! ⇒ Object
- #failed? ⇒ Boolean
-
#initialize(thread) ⇒ SpinnerStatus
constructor
A new instance of SpinnerStatus.
- #set_title(message) ⇒ Object
- #warn ⇒ Object
- #warn? ⇒ Boolean
Constructor Details
#initialize(thread) ⇒ SpinnerStatus
Returns a new instance of SpinnerStatus.
8 9 10 11 |
# File 'lib/kontena/cli/spinner.rb', line 8 def initialize(thread) @thread = thread @result = :done end |
Instance Attribute Details
#result ⇒ Object (readonly)
Returns the value of attribute result.
6 7 8 |
# File 'lib/kontena/cli/spinner.rb', line 6 def result @result end |
#thread ⇒ Object (readonly)
Returns the value of attribute thread.
6 7 8 |
# File 'lib/kontena/cli/spinner.rb', line 6 def thread @thread end |
Instance Method Details
#fail ⇒ Object
29 30 31 |
# File 'lib/kontena/cli/spinner.rb', line 29 def fail @result = :fail end |
#fail! ⇒ Object
33 34 35 36 37 |
# File 'lib/kontena/cli/spinner.rb', line 33 def fail! @result = :fail thread['abort'] = true raise SpinAbort end |
#failed? ⇒ Boolean
25 26 27 |
# File 'lib/kontena/cli/spinner.rb', line 25 def failed? @result == :fail end |
#set_title(message) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/kontena/cli/spinner.rb', line 13 def set_title() if $stdout.tty? thread['update_msg'] = else Kernel.puts "- #{}" end end |
#warn ⇒ Object
39 40 41 |
# File 'lib/kontena/cli/spinner.rb', line 39 def warn @result = :warn end |
#warn? ⇒ Boolean
21 22 23 |
# File 'lib/kontena/cli/spinner.rb', line 21 def warn? @result == :warn end |