Class: Cardigan::Command::OpenWorkflow

Inherits:
Object
  • Object
show all
Defined in:
lib/cardigan/command/open_workflow.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#helpObject (readonly)

Returns the value of attribute help.



5
6
7
# File 'lib/cardigan/command/open_workflow.rb', line 5

def help
  @help
end

#usageObject (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