Class: DispatchPolicy::Decision
- Inherits:
-
Object
- Object
- DispatchPolicy::Decision
- Defined in:
- lib/dispatch_policy/decision.rb
Instance Attribute Summary collapse
-
#allowed ⇒ Object
readonly
Returns the value of attribute allowed.
-
#gate_state_patch ⇒ Object
readonly
Returns the value of attribute gate_state_patch.
-
#reason ⇒ Object
readonly
Returns the value of attribute reason.
-
#retry_after ⇒ Object
readonly
Returns the value of attribute retry_after.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(allowed:, retry_after: nil, gate_state_patch: nil, reason: nil) ⇒ Decision
constructor
A new instance of Decision.
Constructor Details
#initialize(allowed:, retry_after: nil, gate_state_patch: nil, reason: nil) ⇒ Decision
Returns a new instance of Decision.
7 8 9 10 11 12 |
# File 'lib/dispatch_policy/decision.rb', line 7 def initialize(allowed:, retry_after: nil, gate_state_patch: nil, reason: nil) @allowed = allowed @retry_after = retry_after @gate_state_patch = gate_state_patch @reason = reason end |
Instance Attribute Details
#allowed ⇒ Object (readonly)
Returns the value of attribute allowed.
5 6 7 |
# File 'lib/dispatch_policy/decision.rb', line 5 def allowed @allowed end |
#gate_state_patch ⇒ Object (readonly)
Returns the value of attribute gate_state_patch.
5 6 7 |
# File 'lib/dispatch_policy/decision.rb', line 5 def gate_state_patch @gate_state_patch end |
#reason ⇒ Object (readonly)
Returns the value of attribute reason.
5 6 7 |
# File 'lib/dispatch_policy/decision.rb', line 5 def reason @reason end |
#retry_after ⇒ Object (readonly)
Returns the value of attribute retry_after.
5 6 7 |
# File 'lib/dispatch_policy/decision.rb', line 5 def retry_after @retry_after end |
Class Method Details
.deny(retry_after: nil, reason: nil) ⇒ Object
18 19 20 |
# File 'lib/dispatch_policy/decision.rb', line 18 def self.deny(retry_after: nil, reason: nil) new(allowed: 0, retry_after: retry_after, reason: reason) end |
.unlimited ⇒ Object
14 15 16 |
# File 'lib/dispatch_policy/decision.rb', line 14 def self.unlimited new(allowed: Float::INFINITY) end |