Class: Lydia::Application

Inherits:
Router
  • Object
show all
Extended by:
Forwardable
Includes:
Filters, Helpers, Templates
Defined in:
lib/lydia/application.rb

Instance Attribute Summary

Attributes inherited from Router

#env, #request, #response

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Helpers

#content_type, #params, #redirect, #send_file

Methods included from Filters

#dispatch, included, #process_redirects

Methods included from Templates

#render

Methods inherited from Router

#_call, #call, #dispatch, #halt, namespace, #next_route, routes, #routes

Methods included from StandardPages

#halted, #internal_server_error, #not_found

Class Method Details

.builderObject



40
41
42
# File 'lib/lydia/application.rb', line 40

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

.new(*args, &bk) ⇒ Object



44
45
46
47
# File 'lib/lydia/application.rb', line 44

def new(*args, &bk)
  builder.run(super(*args, &bk))
  builder.to_app
end

Instance Method Details

#new_request(env) ⇒ Object



27
28
29
# File 'lib/lydia/application.rb', line 27

def new_request(env)
  Lydia::Request.new(env)
end

#new_response(body = [], status = 200, header = {}) ⇒ Object



31
32
33
# File 'lib/lydia/application.rb', line 31

def new_response(body = [], status = 200, header = {})
  Lydia::Response.new(body, status, header)
end

#processObject



16
17
18
19
20
21
22
23
24
25
# File 'lib/lydia/application.rb', line 16

def process
  result = super
  if result.nil?
    @response.build(200)
  elsif result.class <= Rack::Response
    result.finish
  else
    @response.build(result)
  end
end