Class: CircuitBreaker::Config
- Inherits:
-
Object
- Object
- CircuitBreaker::Config
- Defined in:
- lib/circuit_breaker-ruby/config.rb
Constant Summary collapse
- FAILURE_THRESHOLD =
10- FAILURE_THRESHOLD_PERCENTAGE =
0.5- INVOCATION_TIMEOUT =
10- RETRY_TIMEOUT =
60- UPDATABLE =
[ :invocation_timeout, :failure_threshold, :failure_threshold_percentage, :retry_timeout ]
Instance Attribute Summary collapse
-
#failure_threshold ⇒ Object
Returns the value of attribute failure_threshold.
-
#failure_threshold_percentage ⇒ Object
Returns the value of attribute failure_threshold_percentage.
-
#invocation_timeout ⇒ Object
Returns the value of attribute invocation_timeout.
-
#retry_timeout ⇒ Object
Returns the value of attribute retry_timeout.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
17 18 19 20 21 22 |
# File 'lib/circuit_breaker-ruby/config.rb', line 17 def initialize self.failure_threshold = FAILURE_THRESHOLD self.failure_threshold_percentage = FAILURE_THRESHOLD_PERCENTAGE self.invocation_timeout = INVOCATION_TIMEOUT self.retry_timeout = RETRY_TIMEOUT end |
Instance Attribute Details
#failure_threshold ⇒ Object
Returns the value of attribute failure_threshold.
15 16 17 |
# File 'lib/circuit_breaker-ruby/config.rb', line 15 def failure_threshold @failure_threshold end |
#failure_threshold_percentage ⇒ Object
Returns the value of attribute failure_threshold_percentage.
15 16 17 |
# File 'lib/circuit_breaker-ruby/config.rb', line 15 def failure_threshold_percentage @failure_threshold_percentage end |
#invocation_timeout ⇒ Object
Returns the value of attribute invocation_timeout.
15 16 17 |
# File 'lib/circuit_breaker-ruby/config.rb', line 15 def invocation_timeout @invocation_timeout end |
#retry_timeout ⇒ Object
Returns the value of attribute retry_timeout.
15 16 17 |
# File 'lib/circuit_breaker-ruby/config.rb', line 15 def retry_timeout @retry_timeout end |
Class Method Details
.update(klass, options) ⇒ Object
24 25 26 27 28 |
# File 'lib/circuit_breaker-ruby/config.rb', line 24 def self.update(klass, ) (UPDATABLE & .keys).each do |variable| klass.instance_variable_set("@#{variable}", [variable]) end end |