Class: Rack::PooledThrottle::Throttle
- Inherits:
-
Object
- Object
- Rack::PooledThrottle::Throttle
- Defined in:
- lib/rack/pooledthrottle/throttle.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ Throttle
constructor
A new instance of Throttle.
Constructor Details
#initialize(app, options = {}) ⇒ Throttle
Returns a new instance of Throttle.
6 7 8 |
# File 'lib/rack/pooledthrottle/throttle.rb', line 6 def initialize(app, = {}) @app, @options = app, end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
4 5 6 |
# File 'lib/rack/pooledthrottle/throttle.rb', line 4 def app @app end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/rack/pooledthrottle/throttle.rb', line 4 def @options end |
Instance Method Details
#call(env) ⇒ Object
10 11 12 13 |
# File 'lib/rack/pooledthrottle/throttle.rb', line 10 def call(env) request = Rack::Request.new(env) allowed?(request) ? app.call(env) : rate_limit_exceeded(request) end |