Class: Semaph::Shells::Pipeline::JobsListCommand

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(job_collection) ⇒ JobsListCommand

Returns a new instance of JobsListCommand.



9
10
11
12
# File 'lib/semaph/shells/pipeline/jobs_list_command.rb', line 9

def initialize(job_collection)
  @job_collection = job_collection
  @help = "list jobs"
end

Instance Attribute Details

#helpObject (readonly)

Returns the value of attribute help.



7
8
9
# File 'lib/semaph/shells/pipeline/jobs_list_command.rb', line 7

def help
  @help
end

#usageObject (readonly)

Returns the value of attribute usage.



7
8
9
# File 'lib/semaph/shells/pipeline/jobs_list_command.rb', line 7

def usage
  @usage
end

Instance Method Details

#execute(_whatever = nil) ⇒ Object



14
15
16
17
18
19
# File 'lib/semaph/shells/pipeline/jobs_list_command.rb', line 14

def execute(_whatever = nil)
  @job_collection.reload
  @job_collection.all.each_with_index do |job, index|
    puts [::Semaph::Formatting.index(index + 1), job.description].join(" ")
  end
end