Class: Hyper::Application

Inherits:
Object
  • Object
show all
Includes:
Helper
Defined in:
lib/hyper/application.rb

Constant Summary collapse

NOT_FOUND_TEMPLATE =
Hyper::Utils.view_path('404')

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#requestObject (readonly)

Returns the value of attribute request.



11
12
13
# File 'lib/hyper/application.rb', line 11

def request
  @request
end

Instance Method Details

#call(env) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/hyper/application.rb', line 13

def call(env)
  @request = Rack::Request.new(env)
  url      = request.path
  layout   = Utils.layout_path
  view     = Utils.view_path(url)
  
  if File.file?(view)
    respond_with(200, rendered_templates(layout, view))
  else
    respond_with(404, not_found(layout, url))
  end
end