thin_async 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/thin/async.rb +19 -0
- data/thin_async.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 711e55ba4b239b5d7c0015b48bfb04c0fb098fc2
|
4
|
+
data.tar.gz: 412a90435208ecd29038fe8f4abee78cba26315c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7268a4f5e3ffa41a2ec9114fc18afc12545763150b3e6b5e97c75b008eed343ab86ee844136f06a3bc0a574000e154860d8b9b4ed97aadf0d741422d10b8b764
|
7
|
+
data.tar.gz: c1e8d91c78168985351307498ece1229cfa83f489527c6dab4557c75691c4f10bf71cef5dec9e0b98cd0a041d3e330d042c735e4edc01819c0d3909041d52ceb
|
data/lib/thin/async.rb
CHANGED
@@ -49,6 +49,7 @@ module Thin
|
|
49
49
|
|
50
50
|
def initialize(env, status=200, headers={})
|
51
51
|
@callback = env['async.callback']
|
52
|
+
@close = env['async.close']
|
52
53
|
@body = DeferrableBody.new
|
53
54
|
@status = status
|
54
55
|
@headers = headers
|
@@ -85,6 +86,24 @@ module Thin
|
|
85
86
|
@done
|
86
87
|
end
|
87
88
|
|
89
|
+
# Specify a block to be executed when the response is done
|
90
|
+
#
|
91
|
+
# Calling this method before the response has completed will cause the
|
92
|
+
# callback block to be stored on an internal list.
|
93
|
+
# If you call this method after the response is done, the block will
|
94
|
+
# be executed immediately.
|
95
|
+
#
|
96
|
+
def callback &block
|
97
|
+
@close.callback(&block)
|
98
|
+
self
|
99
|
+
end
|
100
|
+
|
101
|
+
# Cancels an outstanding callback to &block if any. Undoes the action of #callback.
|
102
|
+
#
|
103
|
+
def cancel_callback block
|
104
|
+
@close.cancel_callback(block)
|
105
|
+
end
|
106
|
+
|
88
107
|
# Tell Thin the response is gonna be sent asynchronously.
|
89
108
|
# The status code of -1 is the magic trick here.
|
90
109
|
def finish
|
data/thin_async.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thin_async
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marc-Andre Cournoyer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thin
|