Class: Turning::StaticCascade
- Inherits:
-
Object
- Object
- Turning::StaticCascade
- Defined in:
- lib/turning/static_cascade.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, storage) ⇒ StaticCascade
constructor
A new instance of StaticCascade.
Constructor Details
#initialize(app, storage) ⇒ StaticCascade
Returns a new instance of StaticCascade.
3 4 5 6 |
# File 'lib/turning/static_cascade.rb', line 3 def initialize(app, storage) @app = app @storage = storage end |
Instance Method Details
#call(env) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/turning/static_cascade.rb', line 8 def call(env) if body = @storage.get(env['PATH_INFO']) content_length = body.size headers = { 'Content-Type' => 'text/html', 'Content-Length' => content_length.to_s } [200, headers, [body]] else @app.call(env) end end |