Sha256: fe9e0ee1bf10e07d28e47ab8901d94f1596d330e29d6c84d9a861a5e6c9b6200

Contents?: true

Size: 481 Bytes

Versions: 18

Compression:

Stored size: 481 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

18 entries across 18 versions & 2 rubygems

Version Path
grape-0.4.1 lib/grape/middleware/filter.rb
grape-0.4.0 lib/grape/middleware/filter.rb
grape-0.3.2 lib/grape/middleware/filter.rb
grape-0.3.1 lib/grape/middleware/filter.rb
grape-0.3.0 lib/grape/middleware/filter.rb
grape-0.2.1.1 lib/grape/middleware/filter.rb
grape-0.2.6 lib/grape/middleware/filter.rb
grape-0.2.5 lib/grape/middleware/filter.rb
grape-0.2.4 lib/grape/middleware/filter.rb
grape-0.2.3 lib/grape/middleware/filter.rb
fragrant-0.0.5 vendor/bundle/ruby/1.9.1/gems/grape-0.2.2/lib/grape/middleware/filter.rb
fragrant-0.0.4 vendor/grape/lib/grape/middleware/filter.rb
grape-0.2.2 lib/grape/middleware/filter.rb
fragrant-0.0.3 vendor/grape/lib/grape/middleware/filter.rb
fragrant-0.0.2 vendor/grape/lib/grape/middleware/filter.rb
fragrant-0.0.1 vendor/grape/lib/grape/middleware/filter.rb
grape-0.2.1 lib/grape/middleware/filter.rb
grape-0.2.0 lib/grape/middleware/filter.rb