Class: Smith::Workflow::Graph::OptimizationContract

Inherits:
Object
  • Object
show all
Extended by:
Dry::Initializer
Includes:
ContractHelpers
Defined in:
lib/smith/workflow/graph/optimization_contract.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_transition(transition, workflow_class: nil) ⇒ Object



17
18
19
# File 'lib/smith/workflow/graph/optimization_contract.rb', line 17

def self.from_transition(transition, workflow_class: nil)
  new(transition, workflow_class: workflow_class).to_h if transition.optimization_config
end

Instance Method Details

#to_hObject



21
22
23
24
25
26
27
28
29
# File 'lib/smith/workflow/graph/optimization_contract.rb', line 21

def to_h
  deep_freeze(
    transition_contract.merge(
      exit_modes: exit_modes,
      output_contract: output_contract,
      resume_contract: resume_contract
    ).compact
  )
end