Class: Ki::KiApp

Inherits:
Object show all
Includes:
Middleware::Helpers::HamlCompiler, Middleware::Helpers::View
Defined in:
lib/ki/ki_app.rb

Instance Method Summary collapse

Methods included from Middleware::Helpers::View

#view_exists?, #view_path

Methods included from Middleware::Helpers::HamlCompiler

#render_haml, #render_haml_file

Instance Method Details

#call(env) ⇒ Object



8
9
10
11
12
# File 'lib/ki/ki_app.rb', line 8

def call(env)
  path = view_exists?('404') ? view_path('404') : custom_view_path
  html = render_haml_file(path).strip!
  Rack::Response.new(html, 404).finish
end

#custom_view_pathObject



14
15
16
# File 'lib/ki/ki_app.rb', line 14

def custom_view_path
  File.join(File.dirname(__FILE__), 'views', '404.haml')
end