class Orkester::Middleware

Public Class Methods

new(app=nil) click to toggle source
# File lib/orkester/middleware.rb, line 5
def initialize(app=nil)
  @app = app
end

Public Instance Methods

call(env) click to toggle source
# File lib/orkester/middleware.rb, line 9
def call(env)
  router = Orkester::Router.new
  match = router.try(env)
  if match
    match
  else
    if @app
      @app.call(env)
    else
      [404, {"Content-Type" => "text/html"}, ["404"]]
    end
  end
end