Class: CircuitBreaker::WorkflowBuilder::DSL::StateTransitionBuilder
- Inherits:
-
Object
- Object
- CircuitBreaker::WorkflowBuilder::DSL::StateTransitionBuilder
- Defined in:
- lib/circuit_breaker/workflow_dsl.rb
Instance Method Summary collapse
- #actions(&block) ⇒ Object
-
#initialize(workflow_builder, state_transition) ⇒ StateTransitionBuilder
constructor
A new instance of StateTransitionBuilder.
- #policy(rules) ⇒ Object
- #transition(name) ⇒ Object
Constructor Details
#initialize(workflow_builder, state_transition) ⇒ StateTransitionBuilder
Returns a new instance of StateTransitionBuilder.
76 77 78 79 80 |
# File 'lib/circuit_breaker/workflow_dsl.rb', line 76 def initialize(workflow_builder, state_transition) @workflow_builder = workflow_builder @from_state = state_transition.from @to_state = state_transition.to end |
Instance Method Details
#actions(&block) ⇒ Object
90 91 92 93 94 |
# File 'lib/circuit_breaker/workflow_dsl.rb', line 90 def actions(&block) builder = ActionBuilder.new(@workflow_builder) builder.instance_eval(&block) @workflow_builder.set_action_context(builder.context) end |
#policy(rules) ⇒ Object
86 87 88 |
# File 'lib/circuit_breaker/workflow_dsl.rb', line 86 def policy(rules) @workflow_builder.policy(rules) end |
#transition(name) ⇒ Object
82 83 84 |
# File 'lib/circuit_breaker/workflow_dsl.rb', line 82 def transition(name) @workflow_builder.transition(name, from: @from_state, to: @to_state) end |