Class: Rack::Throttle::Matcher
- Inherits:
-
Object
- Object
- Rack::Throttle::Matcher
- Defined in:
- lib/rack/throttle/matchers/matcher.rb
Overview
This is the base class for matcher implementations. Implementations are provided for User Agent, URL, and request method. Subclass Matcher if you want to provide a custom implementation.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#rule ⇒ Object
readonly
Returns the value of attribute rule.
Instance Method Summary collapse
-
#identifier ⇒ String
abstract
Must be implemented in a subclass.
-
#initialize(rule) ⇒ Matcher
constructor
A new instance of Matcher.
-
#match? ⇒ Boolean
abstract
Must be implemented in a subclass.
Constructor Details
#initialize(rule) ⇒ Matcher
Returns a new instance of Matcher.
10 11 12 |
# File 'lib/rack/throttle/matchers/matcher.rb', line 10 def initialize(rule) @rule = rule end |
Instance Attribute Details
#rule ⇒ Object (readonly)
Returns the value of attribute rule.
8 9 10 |
# File 'lib/rack/throttle/matchers/matcher.rb', line 8 def rule @rule end |
Instance Method Details
#identifier ⇒ String
This method is abstract.
Must be implemented in a subclass. Used to produce a unique key in our cache store. Typically of the form “xx-”
27 28 29 |
# File 'lib/rack/throttle/matchers/matcher.rb', line 27 def identifier "" end |
#match? ⇒ Boolean
This method is abstract.
Must be implemented in a subclass. MUST return true or false.
18 19 20 |
# File 'lib/rack/throttle/matchers/matcher.rb', line 18 def match? true end |