Class: Thin::Async::Test
- Inherits:
-
Object
- Object
- Thin::Async::Test
- Defined in:
- lib/thin/async/test.rb
Defined Under Namespace
Classes: Callback
Constant Summary collapse
- VERSION =
'1.0.0'
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ Test
constructor
A new instance of Test.
Constructor Details
#initialize(app, options = {}) ⇒ Test
Returns a new instance of Test.
21 22 23 |
# File 'lib/thin/async/test.rb', line 21 def initialize(app, ={}) @app = app end |
Instance Method Details
#call(env) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/thin/async/test.rb', line 25 def call(env) callback = Callback.new env.merge! 'async.callback' => callback EM.run do result = @app.call(env) unless result == Thin::AsyncResponse::Marker EM.next_tick do EM.stop return result end end end [callback.status, callback.headers, callback.body] end |