Class: CommandDeck::Middleware
- Inherits:
-
Object
- Object
- CommandDeck::Middleware
- Defined in:
- lib/command_deck/middleware.rb
Overview
Dev-only middleware that injects a tiny floating UI into HTML responses.
Class Attribute Summary collapse
-
.mount_point ⇒ Object
Returns the value of attribute mount_point.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Middleware
constructor
A new instance of Middleware.
Constructor Details
#initialize(app) ⇒ Middleware
Returns a new instance of Middleware.
14 15 16 |
# File 'lib/command_deck/middleware.rb', line 14 def initialize(app) @app = app end |
Class Attribute Details
.mount_point ⇒ Object
Returns the value of attribute mount_point.
10 11 12 |
# File 'lib/command_deck/middleware.rb', line 10 def mount_point @mount_point end |
Instance Method Details
#call(env) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/command_deck/middleware.rb', line 18 def call(env) status, headers, body = @app.call(env) begin return [status, headers, body] unless html_response?(headers) return [status, headers, body] if engine_request?(env) body, headers = Injector.new(body, headers).inject() [status, headers, body] rescue StandardError # Fail open: on any injection error, return original response [status, headers, body] end end |