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: -> { do_something }, after: -> { do_something }
Constant Summary
Constants inherited from Base
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
Methods included from DSL::Headers
Methods included from Helpers
Constructor Details
This class inherits a constructor from Grape::Middleware::Base
Instance Method Details
#after ⇒ Object
14 15 16 |
# File 'lib/grape/middleware/filter.rb', line 14 def after app.instance_eval(&[:after]) if [:after] end |
#before ⇒ Object
10 11 12 |
# File 'lib/grape/middleware/filter.rb', line 10 def before app.instance_eval(&[:before]) if [:before] end |