Class: Markdaver::InjectIndexScript
- Inherits:
-
Object
- Object
- Markdaver::InjectIndexScript
- Defined in:
- lib/markdaver/inject_index_script.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ InjectIndexScript
constructor
A new instance of InjectIndexScript.
Constructor Details
#initialize(app, options = {}) ⇒ InjectIndexScript
Returns a new instance of InjectIndexScript.
3 4 5 6 |
# File 'lib/markdaver/inject_index_script.rb', line 3 def initialize(app, = {}) @app = app @environment = [:markdown_editor_env] end |
Instance Method Details
#call(env) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/markdaver/inject_index_script.rb', line 8 def call(env) if env["PATH_INFO"] == "/" status, header, _ = @app.call env header["Content-Length"] = @environment.index.length.to_s [status, header, [@environment.index]] else @app.call env end end |