Class: HTTPigeon::CircuitBreaker::DataBucket
- Inherits:
-
Object
- Object
- HTTPigeon::CircuitBreaker::DataBucket
- Defined in:
- lib/httpigeon/circuit_breaker/memory_store.rb
Instance Attribute Summary collapse
-
#expires_at ⇒ Object
Returns the value of attribute expires_at.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #expired?(current_time = Time.now.to_i) ⇒ Boolean
-
#initialize(value, expires_at) ⇒ DataBucket
constructor
A new instance of DataBucket.
- #to_h ⇒ Object
Constructor Details
#initialize(value, expires_at) ⇒ DataBucket
Returns a new instance of DataBucket.
91 92 93 94 |
# File 'lib/httpigeon/circuit_breaker/memory_store.rb', line 91 def initialize(value, expires_at) @value = value @expires_at = expires_at end |
Instance Attribute Details
#expires_at ⇒ Object
Returns the value of attribute expires_at.
89 90 91 |
# File 'lib/httpigeon/circuit_breaker/memory_store.rb', line 89 def expires_at @expires_at end |
#value ⇒ Object
Returns the value of attribute value.
89 90 91 |
# File 'lib/httpigeon/circuit_breaker/memory_store.rb', line 89 def value @value end |
Instance Method Details
#expired?(current_time = Time.now.to_i) ⇒ Boolean
96 97 98 |
# File 'lib/httpigeon/circuit_breaker/memory_store.rb', line 96 def expired?(current_time = Time.now.to_i) expires_at < current_time end |
#to_h ⇒ Object
100 101 102 |
# File 'lib/httpigeon/circuit_breaker/memory_store.rb', line 100 def to_h { value: value, expires_at: expires_at } end |