Method: Jsus::Middleware#_call
- Defined in:
- lib/jsus/middleware.rb
#_call(env) ⇒ #each
Since rack apps are used as singletons and we store some state during request handling, we need to separate state between different calls.
Jsus::Middleware#call method dups current rack app and executes Jsus::Middleware#_call on it.
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/jsus/middleware.rb', line 115 def _call(env) Jsus.logger.buffer.clear path = Utils.unescape(env["PATH_INFO"]) return @app.call(env) unless handled_by_jsus?(path) path.sub!(path_prefix_regex, "") components = path.split("/") return @app.call(env) unless components.size >= 2 [:path] = path if components[0] == "require" generate_requires(components[1]) elsif components[0] == "compressed" [:compress] = true generate_requires(components[1]) elsif components[0] == "include" generate_includes(components[1]) else not_found! end end |