Class: Rack::ContentManager
- Inherits:
-
Object
- Object
- Rack::ContentManager
- Defined in:
- lib/rack/content_manager.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ ContentManager
constructor
A new instance of ContentManager.
Constructor Details
#initialize(app) ⇒ ContentManager
Returns a new instance of ContentManager.
3 4 5 |
# File 'lib/rack/content_manager.rb', line 3 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/rack/content_manager.rb', line 7 def call(env) item = ContentItem.find_first_by_url(env["REQUEST_PATH"]) if item.nil? @app.call(env) else response = Rack::Response.new response.write "Hi there" response.finish end end |