Class: Semaph::Shells::Pipeline::JobShowCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/semaph/shells/pipeline/job_show_command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(job_collection) ⇒ JobShowCommand

Returns a new instance of JobShowCommand.



7
8
9
10
11
# File 'lib/semaph/shells/pipeline/job_show_command.rb', line 7

def initialize(job_collection)
  @job_collection = job_collection
  @usage = "<job index>"
  @help = "show job"
end

Instance Attribute Details

#helpObject (readonly)

Returns the value of attribute help.



5
6
7
# File 'lib/semaph/shells/pipeline/job_show_command.rb', line 5

def help
  @help
end

#usageObject (readonly)

Returns the value of attribute usage.



5
6
7
# File 'lib/semaph/shells/pipeline/job_show_command.rb', line 5

def usage
  @usage
end

Instance Method Details

#execute(index_string) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/semaph/shells/pipeline/job_show_command.rb', line 13

def execute(index_string)
  index = index_string.to_i - 1

  job = @job_collection.all[index]

  unless job
    puts "There is no job at position #{index}"
    return
  end

  puts job.show
end