Class: Smith::Workflow::Graph::FanoutContract
- Inherits:
-
Object
- Object
- Smith::Workflow::Graph::FanoutContract
- Defined in:
- lib/smith/workflow/graph/fanout_contract.rb
Instance Attribute Summary collapse
-
#transition ⇒ Object
readonly
Returns the value of attribute transition.
-
#workflow_class ⇒ Object
readonly
Returns the value of attribute workflow_class.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(transition, workflow_class: nil) ⇒ FanoutContract
constructor
A new instance of FanoutContract.
- #to_h ⇒ Object
Constructor Details
#initialize(transition, workflow_class: nil) ⇒ FanoutContract
Returns a new instance of FanoutContract.
16 17 18 19 |
# File 'lib/smith/workflow/graph/fanout_contract.rb', line 16 def initialize(transition, workflow_class: nil) @transition = transition @workflow_class = workflow_class end |
Instance Attribute Details
#transition ⇒ Object (readonly)
Returns the value of attribute transition.
7 8 9 |
# File 'lib/smith/workflow/graph/fanout_contract.rb', line 7 def transition @transition end |
#workflow_class ⇒ Object (readonly)
Returns the value of attribute workflow_class.
7 8 9 |
# File 'lib/smith/workflow/graph/fanout_contract.rb', line 7 def workflow_class @workflow_class end |
Class Method Details
.from_transition(transition, workflow_class: nil) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/smith/workflow/graph/fanout_contract.rb', line 9 def self.from_transition(transition, workflow_class: nil) branches = transition.fanout_config&.fetch(:branches, nil) return unless branches new(transition, workflow_class: workflow_class).to_h end |
Instance Method Details
#to_h ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/smith/workflow/graph/fanout_contract.rb', line 21 def to_h deep_freeze( branch_count: branches.length, join_state: immutable_value(transition.to), output_shape: :named_branch_results, branch_order: :declaration_order, join: join_contract, output_contract: output_contract, resume_contract: resume_contract, branches: branch_summaries, branch_contracts: branch_contracts ) end |