Class: Novel::WorkflowBuilder
- Inherits:
-
Object
- Object
- Novel::WorkflowBuilder
- Defined in:
- lib/novel/workflow_builder.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#raw_workflow ⇒ Object
readonly
Returns the value of attribute raw_workflow.
-
#repository ⇒ Object
readonly
Returns the value of attribute repository.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(name:, repository:, raw_workflow: []) ⇒ WorkflowBuilder
constructor
A new instance of WorkflowBuilder.
- #register_step(name, activity:, compensation: nil) ⇒ Object
Constructor Details
#initialize(name:, repository:, raw_workflow: []) ⇒ WorkflowBuilder
Returns a new instance of WorkflowBuilder.
5 6 7 8 9 |
# File 'lib/novel/workflow_builder.rb', line 5 def initialize(name:, repository:, raw_workflow: []) @name = name @raw_workflow = raw_workflow @repository = repository end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/novel/workflow_builder.rb', line 3 def name @name end |
#raw_workflow ⇒ Object (readonly)
Returns the value of attribute raw_workflow.
3 4 5 |
# File 'lib/novel/workflow_builder.rb', line 3 def raw_workflow @raw_workflow end |
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
3 4 5 |
# File 'lib/novel/workflow_builder.rb', line 3 def repository @repository end |
Instance Method Details
#build ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/novel/workflow_builder.rb', line 19 def build Saga.new( name: name, workflow: Workflow.new(raw: raw_workflow), executor: Executor.new(container: build_container, repository: repository) ) end |
#register_step(name, activity:, compensation: nil) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/novel/workflow_builder.rb', line 11 def register_step(name, activity:, compensation: nil) self.class.new( name: name, repository: repository, raw_workflow: raw_workflow + [{ name: name, activity: activity, compensation: compensation }] ) end |