Class: Semaph::Shells::Pipeline::JobShowCommand
- Inherits:
-
Object
- Object
- Semaph::Shells::Pipeline::JobShowCommand
- Defined in:
- lib/semaph/shells/pipeline/job_show_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) ⇒ JobShowCommand
constructor
A new instance of JobShowCommand.
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
#help ⇒ Object (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 |
#usage ⇒ Object (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 |