Class: Labkit::RateLimit::Result
- Inherits:
-
Data
- Object
- Data
- Labkit::RateLimit::Result
- Defined in:
- lib/labkit/rate_limit/result.rb
Overview
Result is the return value of Limiter#check. matched? - true if a rule’s match conditions were satisfied exceeded? - true if the matched rule’s counter exceeded its limit action - :block or :log (nil when matched? is false) rule - the matched Rule object (nil when matched? is false) error? - true if Redis was unavailable; result fails open (exceeded? is false)
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#exceeded ⇒ Object
readonly
Returns the value of attribute exceeded.
-
#matched ⇒ Object
readonly
Returns the value of attribute matched.
-
#rule ⇒ Object
readonly
Returns the value of attribute rule.
Instance Method Summary collapse
- #error? ⇒ Boolean
- #exceeded? ⇒ Boolean
-
#initialize(matched:, exceeded: false, action: nil, rule: nil, error: false) ⇒ Result
constructor
A new instance of Result.
- #matched? ⇒ Boolean
Constructor Details
#initialize(matched:, exceeded: false, action: nil, rule: nil, error: false) ⇒ Result
Returns a new instance of Result.
12 13 14 |
# File 'lib/labkit/rate_limit/result.rb', line 12 def initialize(matched:, exceeded: false, action: nil, rule: nil, error: false) super end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action
11 12 13 |
# File 'lib/labkit/rate_limit/result.rb', line 11 def action @action end |
#error ⇒ Object (readonly)
Returns the value of attribute error
11 12 13 |
# File 'lib/labkit/rate_limit/result.rb', line 11 def error @error end |
#exceeded ⇒ Object (readonly)
Returns the value of attribute exceeded
11 12 13 |
# File 'lib/labkit/rate_limit/result.rb', line 11 def exceeded @exceeded end |
#matched ⇒ Object (readonly)
Returns the value of attribute matched
11 12 13 |
# File 'lib/labkit/rate_limit/result.rb', line 11 def matched @matched end |
#rule ⇒ Object (readonly)
Returns the value of attribute rule
11 12 13 |
# File 'lib/labkit/rate_limit/result.rb', line 11 def rule @rule end |
Instance Method Details
#error? ⇒ Boolean
24 25 26 |
# File 'lib/labkit/rate_limit/result.rb', line 24 def error? error end |
#exceeded? ⇒ Boolean
20 21 22 |
# File 'lib/labkit/rate_limit/result.rb', line 20 def exceeded? exceeded end |
#matched? ⇒ Boolean
16 17 18 |
# File 'lib/labkit/rate_limit/result.rb', line 16 def matched? matched end |