Class: Semaph::Shells::Workflow::PipelinesSelectCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/semaph/shells/workflow/pipelines_select_command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pipeline_collection) ⇒ PipelinesSelectCommand

Returns a new instance of PipelinesSelectCommand.



9
10
11
12
13
# File 'lib/semaph/shells/workflow/pipelines_select_command.rb', line 9

def initialize(pipeline_collection)
  @pipeline_collection = pipeline_collection
  @usage = "<pipeline index>"
  @help = "choose pipeline by index"
end

Instance Attribute Details

#helpObject (readonly)

Returns the value of attribute help.



7
8
9
# File 'lib/semaph/shells/workflow/pipelines_select_command.rb', line 7

def help
  @help
end

#usageObject (readonly)

Returns the value of attribute usage.



7
8
9
# File 'lib/semaph/shells/workflow/pipelines_select_command.rb', line 7

def usage
  @usage
end

Instance Method Details

#execute(index_string) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/semaph/shells/workflow/pipelines_select_command.rb', line 15

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

  pipeline = @pipeline_collection.all[index]

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

  ::Semaph::Shells::Pipeline::PipelineShell.new(pipeline).push
end