Class: Reck::Application

Inherits:
Object
  • Object
show all
Defined in:
lib/reck/application.rb

Class Method Summary collapse

Class Method Details

.call(env) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/reck/application.rb', line 34

def self.call(env)
  req = Rack::Request.new(env)
  if route = routes.find {|r| r.path.chomp('/') == req.path_info.chomp('/') }
    route.call(req)
    fail 'invalid response'
  else
    [404, {}, ['Not Found']]
  end
rescue Reck::Response => e
  [STATUS[e.class], {}, [e.head? ? nil : e.render].compact]
rescue => e
  env['rack.exception'] = e
  [500, {}, ['Internal Server Error']]
end

.routesObject



49
50
51
# File 'lib/reck/application.rb', line 49

def self.routes
  @@routes ||= []
end