Class: Ki::KiApp

Inherits:
Object
  • 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



6
7
8
9
10
# File 'lib/ki/ki_app.rb', line 6

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



12
13
14
# File 'lib/ki/ki_app.rb', line 12

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