Class: Roger::Rack::Roger
- Inherits:
-
Object
- Object
- Roger::Rack::Roger
- Defined in:
- lib/roger/rack/roger.rb
Overview
Roger middleware that processe roger templates
Instance Attribute Summary collapse
-
#project ⇒ Object
readonly
Returns the value of attribute project.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(project) ⇒ Roger
constructor
A new instance of Roger.
Constructor Details
Instance Attribute Details
#project ⇒ Object (readonly)
Returns the value of attribute project.
12 13 14 |
# File 'lib/roger/rack/roger.rb', line 12 def project @project end |
Instance Method Details
#call(env) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/roger/rack/roger.rb', line 22 def call(env) url = env["PATH_INFO"] env["MOCKUP_PROJECT"] = env["roger.project"] || @project if template_path = @resolver.url_to_path(url) env["rack.errors"].puts "Rendering template #{template_path.inspect} (#{url.inspect})" build_response(template_path, env).finish else env["rack.errors"].puts "Invoking file handler for #{url.inspect}" @file_server.call(env) end end |