Class: Grape::Middleware::Filter
- Defined in:
- lib/grape/middleware/filter.rb
Overview
This is a simple middleware for adding before and after filters to Grape APIs. It is used like so:
use Grape::Middleware::Filter, before: lambda { do_something }, after: lambda { do_something }
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#call, #call!, #content_type, #content_type_for, #content_types, #default_options, #initialize, #mime_types, #response
Constructor Details
This class inherits a constructor from Grape::Middleware::Base
Instance Method Details
#after ⇒ Object
12 13 14 |
# File 'lib/grape/middleware/filter.rb', line 12 def after app.instance_eval(&[:after]) if [:after] end |
#before ⇒ Object
8 9 10 |
# File 'lib/grape/middleware/filter.rb', line 8 def before app.instance_eval(&[:before]) if [:before] end |