Class: Labkit::RateLimit::Result::Evaluation
- Inherits:
-
Data
- Object
- Data
- Labkit::RateLimit::Result::Evaluation
- Includes:
- Comparable
- Defined in:
- lib/labkit/rate_limit/result.rb
Overview
The outcome of counting one matched rule. rule - the evaluated Rule exceeded - whether the post-increment count exceeded the resolved limit info - Result::Info with the per-window counters
Evaluations order by constraint: a blocking evaluation (:limit rule over its limit) ranks strictly first - it decides the request no matter what any other rule reports - then exceeded ones, then fewest remaining. remaining floors at 0, so an exceeded :log rule ties with one sitting exactly on its limit; ranking exceeded ahead keeps a breach from being hidden by a rule that merely reached its limit.
Instance Attribute Summary collapse
-
#exceeded ⇒ Object
readonly
Returns the value of attribute exceeded.
-
#info ⇒ Object
readonly
Returns the value of attribute info.
-
#rule ⇒ Object
readonly
Returns the value of attribute rule.
Instance Method Summary collapse
Instance Attribute Details
#exceeded ⇒ Object (readonly)
Returns the value of attribute exceeded
128 129 130 |
# File 'lib/labkit/rate_limit/result.rb', line 128 def exceeded @exceeded end |
#info ⇒ Object (readonly)
Returns the value of attribute info
128 129 130 |
# File 'lib/labkit/rate_limit/result.rb', line 128 def info @info end |
#rule ⇒ Object (readonly)
Returns the value of attribute rule
128 129 130 |
# File 'lib/labkit/rate_limit/result.rb', line 128 def rule @rule end |
Instance Method Details
#<=>(other) ⇒ Object
139 140 141 |
# File 'lib/labkit/rate_limit/result.rb', line 139 def <=>(other) constraint_rank <=> other.constraint_rank end |
#block? ⇒ Boolean
135 136 137 |
# File 'lib/labkit/rate_limit/result.rb', line 135 def block? exceeded? && rule.action == :limit end |
#exceeded? ⇒ Boolean
131 132 133 |
# File 'lib/labkit/rate_limit/result.rb', line 131 def exceeded? exceeded end |