Class: Kenji::App

Inherits:
Object
  • Object
show all
Defined in:
lib/kenji/app.rb

Overview

Kenji::App is a simple wrapper class that helps avoid the awkward wrapping in a lambda typically necessary for using Kenji as a Rack app. Instead, simply do the following:

run Kenji::App.new(directory: Dir.getwd)

Any options passed will also be forwarded to Kenji.

Kenji::App has one instance for the app, unlike Kenji::Kenji which has one instance per request.

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ App

Returns a new instance of App.



17
18
19
# File 'lib/kenji/app.rb', line 17

def initialize(opts = {})
  @opts = opts
end

Instance Method Details

#call(env) ⇒ Object



21
22
23
# File 'lib/kenji/app.rb', line 21

def call(env)
  Kenji.new(env, @opts).call
end