Class: RackPhantom::Middleware
- Inherits:
-
Object
- Object
- RackPhantom::Middleware
- Defined in:
- lib/rack_phantom.rb
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.
15 16 17 |
# File 'lib/rack_phantom.rb', line 15 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/rack_phantom.rb', line 19 def call(env) status, headers, response = @app.call(env) return [status, headers, response] unless render?(headers, env) html = Phantomjs.run('js/render.js', %['#{response}']) [status, headers, html] end |