Class: Semaph::Shells::Pipeline::JobStopCommand
- Inherits:
-
Object
- Object
- Semaph::Shells::Pipeline::JobStopCommand
- Defined in:
- lib/semaph/shells/pipeline/job_stop_command.rb
Instance Attribute Summary collapse
-
#help ⇒ Object
readonly
Returns the value of attribute help.
-
#usage ⇒ Object
readonly
Returns the value of attribute usage.
Instance Method Summary collapse
- #execute(index_string) ⇒ Object
-
#initialize(job_collection) ⇒ JobStopCommand
constructor
A new instance of JobStopCommand.
Constructor Details
#initialize(job_collection) ⇒ JobStopCommand
Returns a new instance of JobStopCommand.
7 8 9 10 11 |
# File 'lib/semaph/shells/pipeline/job_stop_command.rb', line 7 def initialize(job_collection) @job_collection = job_collection @usage = "<job index>" @help = "stop job" end |
Instance Attribute Details
#help ⇒ Object (readonly)
Returns the value of attribute help.
5 6 7 |
# File 'lib/semaph/shells/pipeline/job_stop_command.rb', line 5 def help @help end |
#usage ⇒ Object (readonly)
Returns the value of attribute usage.
5 6 7 |
# File 'lib/semaph/shells/pipeline/job_stop_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_stop_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 job.stop end |