Class: Cardigan::Command::OpenWorkflow
- Inherits:
-
Object
- Object
- Cardigan::Command::OpenWorkflow
- Defined in:
- lib/cardigan/command/open_workflow.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(name) ⇒ Object
-
#initialize(workflow_repository, io) ⇒ OpenWorkflow
constructor
A new instance of OpenWorkflow.
Constructor Details
#initialize(workflow_repository, io) ⇒ OpenWorkflow
Returns a new instance of OpenWorkflow.
7 8 9 10 11 |
# File 'lib/cardigan/command/open_workflow.rb', line 7 def initialize workflow_repository, io @workflow_repository, @io = workflow_repository, io @usage = '' @help = 'Opens the current workflow for editing' end |
Instance Attribute Details
#help ⇒ Object (readonly)
Returns the value of attribute help.
5 6 7 |
# File 'lib/cardigan/command/open_workflow.rb', line 5 def help @help end |
#usage ⇒ Object (readonly)
Returns the value of attribute usage.
5 6 7 |
# File 'lib/cardigan/command/open_workflow.rb', line 5 def usage @usage end |
Instance Method Details
#execute(name) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/cardigan/command/open_workflow.rb', line 13 def execute name workflow = @workflow_repository.load original = workflow.dup Cardigan::WorkflowContext.new(@io, workflow).push @workflow_repository.save workflow unless workflow == original end |