Class: MotherBrain::CliClient

Inherits:
Object
  • Object
show all
Defined in:
lib/mb/cli_client.rb

Overview

A class for encapsulating view behavior for a user of the CLI.

Examples:


job = MotherBrain::Job.new
CliClient.new(job).display

Constant Summary collapse

SPACE =
" "
TICK =
0.1

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(job) ⇒ CliClient

Returns a new instance of CliClient.

Parameters:



17
18
19
# File 'lib/mb/cli_client.rb', line 17

def initialize(job)
  @job = job
end

Instance Attribute Details

#current_statusObject

Returns the value of attribute current_status.



13
14
15
# File 'lib/mb/cli_client.rb', line 13

def current_status
  @current_status
end

#jobObject (readonly)

Returns the value of attribute job.



14
15
16
# File 'lib/mb/cli_client.rb', line 14

def job
  @job
end

#last_spunObject

Returns the value of attribute last_spun.



13
14
15
# File 'lib/mb/cli_client.rb', line 13

def last_spun
  @last_spun
end

Instance Method Details

#displayObject

Block and wait for all jobs to be completed, while displaying the status of each job.



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/mb/cli_client.rb', line 23

def display
  if debugging?
    wait_for_jobs
  else
    display_jobs
  end

  if job_failed?
    display_log_location if log_location
    abort
  end
end