Class: Jeanine::App

Inherits:
Object
  • Object
show all
Extended by:
Routing::DSL
Includes:
Routing::Evaluation
Defined in:
lib/jeanine/app.rb

Constant Summary

Constants included from Routing::DSL

Routing::DSL::RouteError

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Routing::DSL

delete, get, head, match, options, patch, path, post, put, root

Methods included from Routing::Evaluation

#route_eval

Instance Attribute Details

#requestObject (readonly)

Returns the value of attribute request.



10
11
12
# File 'lib/jeanine/app.rb', line 10

def request
  @request
end

#responseObject (readonly)

Returns the value of attribute response.



10
11
12
# File 'lib/jeanine/app.rb', line 10

def response
  @response
end

Class Method Details

._newObject



34
# File 'lib/jeanine/app.rb', line 34

alias :_new :new

.call(env) ⇒ Object



53
54
55
# File 'lib/jeanine/app.rb', line 53

def call(env)
  new.call env
end

.initialize!Object



41
42
43
# File 'lib/jeanine/app.rb', line 41

def initialize!
  Mimes.load!
end

.installed_pluginsObject



22
23
24
# File 'lib/jeanine/app.rb', line 22

def self.installed_plugins
  Jeanine._installed_plugins
end

.new(*args, &block) ⇒ Object



35
36
37
38
39
# File 'lib/jeanine/app.rb', line 35

def new(*args, &block)
  initialize!
  stack.run _new(*args, &block)
  stack
end

.plugin(name) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/jeanine/app.rb', line 12

def self.plugin(name)
  unless Jeanine._installed_plugins.include?(name)
    unless const_defined?("Jeanine::#{name}")
      require "jeanine/#{name.to_s.underscore}"
    end
    include Kernel.const_get("Jeanine::#{name}")
    Jeanine._installed_plugins << name
  end
end

.routerObject



49
50
51
# File 'lib/jeanine/app.rb', line 49

def router
  Jeanine.router
end

.stackObject



45
46
47
# File 'lib/jeanine/app.rb', line 45

def stack
  @stack ||= Rack::Builder.new
end

Instance Method Details

#call(env) ⇒ Object



58
59
60
61
62
63
# File 'lib/jeanine/app.rb', line 58

def call(env)
  @env = env
  @request = Jeanine::Request.new(env)
  @response = Jeanine::Response.new
  catch(:halt) { route_eval }
end