Class: Rack::Congestion::PathLimiter
- Defined in:
- lib/rack/congestion/path_limiter.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
Returns the value of attribute path.
-
#path_matcher ⇒ Object
Returns the value of attribute path_matcher.
Attributes inherited from Limiter
Instance Method Summary collapse
- #_call(env) ⇒ Object
- #ignored? ⇒ Boolean
-
#initialize(app, options = { }) ⇒ PathLimiter
constructor
A new instance of PathLimiter.
- #key ⇒ Object
Methods inherited from Limiter
#backoff, #call, #rejected_response, #request
Constructor Details
#initialize(app, options = { }) ⇒ PathLimiter
Returns a new instance of PathLimiter.
6 7 8 9 10 |
# File 'lib/rack/congestion/path_limiter.rb', line 6 def initialize(app, = { }) self.path = normalize_path_from self.path_matcher = normalize_matcher_from super end |
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
4 5 6 |
# File 'lib/rack/congestion/path_limiter.rb', line 4 def path @path end |
#path_matcher ⇒ Object
Returns the value of attribute path_matcher.
4 5 6 |
# File 'lib/rack/congestion/path_limiter.rb', line 4 def path_matcher @path_matcher end |
Instance Method Details
#_call(env) ⇒ Object
12 13 14 15 |
# File 'lib/rack/congestion/path_limiter.rb', line 12 def _call(env) @env = env ignored? ? app.call(env) : super(env) end |
#ignored? ⇒ Boolean
21 22 23 |
# File 'lib/rack/congestion/path_limiter.rb', line 21 def ignored? request.path !~ path_matcher end |
#key ⇒ Object
17 18 19 |
# File 'lib/rack/congestion/path_limiter.rb', line 17 def key ->{ path } end |