Sha256: a4e8f95ff8a639842481636851c0be513ba0ba767526e063a922b90c34d121d7

Contents?: true

Size: 479 Bytes

Versions: 10

Compression:

Stored size: 479 Bytes

Contents

module Grape
  module Middleware
    # 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 }
    class Filter < Base
      def before
        app.instance_eval(&options[:before]) if options[:before]
      end

      def after
        app.instance_eval(&options[:after]) if options[:after]
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
grape-security-0.8.0 lib/grape/middleware/filter.rb
grape-0.13.0 lib/grape/middleware/filter.rb
grape-0.12.0 lib/grape/middleware/filter.rb
grape-0.11.0 lib/grape/middleware/filter.rb
grape-0.10.1 lib/grape/middleware/filter.rb
grape-0.10.0 lib/grape/middleware/filter.rb
grape-0.9.0 lib/grape/middleware/filter.rb
grape-0.8.0 lib/grape/middleware/filter.rb
grape-0.7.0 lib/grape/middleware/filter.rb
grape-0.6.1 lib/grape/middleware/filter.rb