Class: CircuitBreaker::Token::StateConfigDSL
- Inherits:
-
Object
- Object
- CircuitBreaker::Token::StateConfigDSL
- Defined in:
- lib/circuit_breaker/token.rb
Overview
DSL for state configuration
Instance Method Summary collapse
-
#initialize(token_class) ⇒ StateConfigDSL
constructor
A new instance of StateConfigDSL.
- #on_states(states, timestamps:) ⇒ Object
- #state(name, timestamps: nil, message: nil, &block) ⇒ Object
Constructor Details
#initialize(token_class) ⇒ StateConfigDSL
Returns a new instance of StateConfigDSL.
167 168 169 |
# File 'lib/circuit_breaker/token.rb', line 167 def initialize(token_class) @token_class = token_class end |
Instance Method Details
#on_states(states, timestamps:) ⇒ Object
175 176 177 178 179 |
# File 'lib/circuit_breaker/token.rb', line 175 def on_states(states, timestamps:) Array().each do || @token_class.(, on_states: states) end end |
#state(name, timestamps: nil, message: nil, &block) ⇒ Object
171 172 173 |
# File 'lib/circuit_breaker/token.rb', line 171 def state(name, timestamps: nil, message: nil, &block) @token_class.state_config(name, timestamps: , message: , &block) end |