Class: Rack::Throttle::MethodMatcher
- Defined in:
- lib/rack/throttle/matchers/method_matcher.rb
Overview
MethodMatchers are used to restrict throttling based on the HTTP method used by the request. For instance, you may only care about throttling POST requests on a login form; GET requests are just fine. MethodMatchers take Symbol objects of :get, :put, :post, or :delete
Instance Attribute Summary
Attributes inherited from Matcher
Instance Method Summary collapse
Methods inherited from Matcher
Constructor Details
This class inherits a constructor from Rack::Throttle::Matcher
Instance Method Details
#identifier ⇒ String
19 20 21 |
# File 'lib/rack/throttle/matchers/method_matcher.rb', line 19 def identifier "meth-#{@rule}" end |
#match?(request) ⇒ Boolean
12 13 14 15 |
# File 'lib/rack/throttle/matchers/method_matcher.rb', line 12 def match?(request) rack_method = :"#{@rule}?" request.send(rack_method) end |