Class: Roger::Rack::Roger
- Inherits:
-
Object
- Object
- Roger::Rack::Roger
- Includes:
- Helpers::GetFiles
- Defined in:
- lib/roger/rack/roger.rb
Overview
Roger middleware that processe roger templates
Constant Summary
Constants included from Helpers::GetFiles
Helpers::GetFiles::GLOB_OPTIONS
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
Instance Method Summary collapse
- #call(env) ⇒ Object
- #default_options ⇒ Object
- #initialize(project, options = {}) ⇒ Object constructor
Methods included from Helpers::GetFiles
Constructor Details
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
13 14 15 |
# File 'lib/roger/rack/roger.rb', line 13 def @options end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
13 14 15 |
# File 'lib/roger/rack/roger.rb', line 13 def project @project end |
Instance Method Details
#call(env) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/roger/rack/roger.rb', line 36 def call(env) url = env["PATH_INFO"] env["MOCKUP_PROJECT"] = env["roger.project"] || @project template_path = @resolver.url_to_path(url) if process_path_by_roger?(template_path) 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 |
#default_options ⇒ Object
15 16 17 18 19 20 |
# File 'lib/roger/rack/roger.rb', line 15 def { match: ["**/*.{html,md,html.erb}"], skip: [] } end |