Class: Rack::NotFound
- Inherits:
-
Object
- Object
- Rack::NotFound
- Defined in:
- lib/middleman/apps/rack_contrib.rb
Overview
Constant Summary collapse
- F =
::File
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(path = nil, content_type = 'text/html') ⇒ NotFound
constructor
A new instance of NotFound.
Constructor Details
#initialize(path = nil, content_type = 'text/html') ⇒ NotFound
Returns a new instance of NotFound.
62 63 64 65 66 67 68 69 70 71 |
# File 'lib/middleman/apps/rack_contrib.rb', line 62 def initialize(path = nil, content_type = 'text/html') if path.nil? @content = "Not found\n" else @content = F.read(path) end @length = @content.size.to_s @content_type = content_type end |
Instance Method Details
#call(env) ⇒ Object
73 74 75 |
# File 'lib/middleman/apps/rack_contrib.rb', line 73 def call(env) [404, {'Content-Type' => @content_type, 'Content-Length' => @length}, [@content]] end |