Class: Cardigan::WorkflowRepository
- Inherits:
-
Object
- Object
- Cardigan::WorkflowRepository
- Defined in:
- lib/cardigan/workflow_repository.rb
Instance Method Summary collapse
-
#initialize(directory) ⇒ WorkflowRepository
constructor
A new instance of WorkflowRepository.
- #load ⇒ Object
- #save(workflow) ⇒ Object
Constructor Details
#initialize(directory) ⇒ WorkflowRepository
Returns a new instance of WorkflowRepository.
7 8 9 10 |
# File 'lib/cardigan/workflow_repository.rb', line 7 def initialize directory @directory = directory @key = '.card_workflow' end |
Instance Method Details
#load ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/cardigan/workflow_repository.rb', line 19 def load workflow = @directory.exist?(@key) ? @directory[@key] : {} workflow.keys.each do |key| workflow[key] = workflow[key].split("\n") unless workflow[key].instance_of?(Array) end workflow end |
#save(workflow) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/cardigan/workflow_repository.rb', line 12 def save workflow workflow.keys.each do |key| workflow[key] = workflow[key].join("\n") end @directory[@key] = workflow end |