Class: Kontena::Cli::SpinnerStatus

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#resultObject (readonly)

Returns the value of attribute result.



6
7
8
# File 'lib/kontena/cli/spinner.rb', line 6

def result
  @result
end

#threadObject (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

#failObject



29
30
31
# File 'lib/kontena/cli/spinner.rb', line 29

def fail
  @result = :fail
end

#fail!Object

Raises:



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

Returns:

  • (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(message)
  if $stdout.tty?
    thread['update_msg'] = message
  else
    Kernel.puts "- #{message}"
  end
end

#warnObject



39
40
41
# File 'lib/kontena/cli/spinner.rb', line 39

def warn
  @result = :warn
end

#warn?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/kontena/cli/spinner.rb', line 21

def warn?
  @result == :warn
end