Sha256: 51639532bcd22614cd31169ef118c8961408e821efebb7758a8e9e80fd17c84e

Contents?: true

Size: 792 Bytes

Versions: 31

Compression:

Stored size: 792 Bytes

Contents

##
# Ancestor of all middlewares
class Midori::Middleware
  # Init a middleware
  def initialize
  end

  # run before processing a request
  # @param [Midori::Request] request raw request
  # @return [Midori::Request] request to be further processed
  def before(request)
    request
  end

  # run after processing a request
  # @param [Midori::Request] _request raw request
  # @param [Midori::Response] response raw response
  # @return [Midori::Response] response to be further processed
  def after(_request, response)
    response
  end

  # Dynamically generate a method to use inside router
  # @param [Symbol] name name of the method
  # @yield the block to run
  def self.helper(name, &block)
    Midori::CleanRoom.class_exec do
      define_method(name, &block)
    end
  end
end

Version data entries

31 entries across 31 versions & 2 rubygems

Version Path
midori.rb-0.9.0 lib/midori/middleware.rb
midori.rb-0.8.0 lib/midori/middleware.rb
midori.rb-0.7.1 lib/midori/middleware.rb
midori.rb-0.7.0 lib/midori/middleware.rb
midori.rb-0.6.0 lib/midori/middleware.rb
midori.rb-0.5.4 lib/midori/middleware.rb
midori.rb-0.5.3.1 lib/midori/middleware.rb
midori.rb-0.5.3 lib/midori/middleware.rb
midori.rb-0.5.2 lib/midori/middleware.rb
midori.rb-0.5.1 lib/midori/middleware.rb
midori.rb-0.5.0 lib/midori/middleware.rb
midori.rb-0.4.4.1 lib/midori/middleware.rb
midori.rb-0.4.4 lib/midori/middleware.rb
midori.rb-0.4.3 lib/midori/middleware.rb
em-midori-0.4.3 lib/midori/middleware.rb
em-midori-0.4.2.1 lib/midori/middleware.rb
em-midori-0.4.2 lib/midori/middleware.rb
em-midori-0.4.1.1 lib/midori/middleware.rb
em-midori-0.4.1 lib/midori/middleware.rb
em-midori-0.4.0 lib/midori/middleware.rb