Class: Tiltd::Application

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

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/tiltd/application.rb', line 3

def call(env)
  request = Rack::Request.new(env)
  headers = {}

  if content = Content.locate(request.path_info)
    headers['Content-Type'] = content.mime_type
    code = 200
    body = content.body
  else
    code = 404
    body = ''
  end

  [ code, headers, [body] ]
end