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 (a :limit rule over its limit, or one whose ban is still in force) 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
143 144 145 |
# File 'lib/labkit/rate_limit/result.rb', line 143 def exceeded @exceeded end |
#info ⇒ Object (readonly)
Returns the value of attribute info
143 144 145 |
# File 'lib/labkit/rate_limit/result.rb', line 143 def info @info end |
#rule ⇒ Object (readonly)
Returns the value of attribute rule
143 144 145 |
# File 'lib/labkit/rate_limit/result.rb', line 143 def rule @rule end |
Instance Method Details
#<=>(other) ⇒ Object
154 155 156 |
# File 'lib/labkit/rate_limit/result.rb', line 154 def <=>(other) constraint_rank <=> other.constraint_rank end |
#block? ⇒ Boolean
150 151 152 |
# File 'lib/labkit/rate_limit/result.rb', line 150 def block? exceeded? && rule.action == :limit end |
#exceeded? ⇒ Boolean
146 147 148 |
# File 'lib/labkit/rate_limit/result.rb', line 146 def exceeded? exceeded end |