Class: CircuitBreaker::WorkflowBuilder::DSL::StateTransitionBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/circuit_breaker/workflow_dsl.rb

Instance Method Summary collapse

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