Class: Semaph::Shells::Project::WorkflowsSelectCommand
- Inherits:
-
Object
- Object
- Semaph::Shells::Project::WorkflowsSelectCommand
- Defined in:
- lib/semaph/shells/project/workflows_select_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(workflow_collection) ⇒ WorkflowsSelectCommand
constructor
A new instance of WorkflowsSelectCommand.
Constructor Details
#initialize(workflow_collection) ⇒ WorkflowsSelectCommand
Returns a new instance of WorkflowsSelectCommand.
10 11 12 13 14 |
# File 'lib/semaph/shells/project/workflows_select_command.rb', line 10 def initialize(workflow_collection) @workflow_collection = workflow_collection @usage = "<workflow index>" @help = "choose workflow by index" end |
Instance Attribute Details
#help ⇒ Object (readonly)
Returns the value of attribute help.
8 9 10 |
# File 'lib/semaph/shells/project/workflows_select_command.rb', line 8 def help @help end |
#usage ⇒ Object (readonly)
Returns the value of attribute usage.
8 9 10 |
# File 'lib/semaph/shells/project/workflows_select_command.rb', line 8 def usage @usage end |
Instance Method Details
#execute(index_string) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/semaph/shells/project/workflows_select_command.rb', line 16 def execute(index_string) index = index_string.to_i - 1 workflow = @workflow_collection.all[index] unless workflow puts "There is no workflow at position #{index}" return end ::Semaph::Shells::Workflow::WorkflowShell.new(workflow).push end |