Class: Synthra::Behaviors::CloseConnection
- Defined in:
- lib/synthra/behaviors/close_connection.rb
Overview
Close connection behavior - simulates connection drop
Raises SimulatedConnectionDrop exception when activated, simulating a network connection failure.
Instance Method Summary collapse
-
#apply(result, context = nil) ⇒ Object
Apply close connection behavior.
Constructor Details
This class inherits a constructor from Synthra::Behaviors::Base
Instance Method Details
#apply(result, context = nil) ⇒ Object
Apply close connection behavior
Raises SimulatedConnectionDrop if the behavior should be applied based on probability.
50 51 52 53 54 55 56 |
# File 'lib/synthra/behaviors/close_connection.rb', line 50 def apply(result, context = nil) if should_apply? probability = extract_probability raise SimulatedConnectionDrop.new(probability: probability) end result end |