Class: Sinatra::Async::Test::AsyncSession::AsyncCloser
- Inherits:
-
Object
- Object
- Sinatra::Async::Test::AsyncSession::AsyncCloser
- Defined in:
- lib/sinatra/async/test.rb
Instance Method Summary collapse
- #callback(&b) ⇒ Object
- #errback(&b) ⇒ Object
- #fail ⇒ Object
-
#initialize ⇒ AsyncCloser
constructor
A new instance of AsyncCloser.
- #succeed ⇒ Object
Constructor Details
#initialize ⇒ AsyncCloser
Returns a new instance of AsyncCloser.
14 15 16 |
# File 'lib/sinatra/async/test.rb', line 14 def initialize @callbacks, @errbacks = [], [] end |
Instance Method Details
#callback(&b) ⇒ Object
17 18 19 |
# File 'lib/sinatra/async/test.rb', line 17 def callback(&b) @callbacks << b end |
#errback(&b) ⇒ Object
20 21 22 |
# File 'lib/sinatra/async/test.rb', line 20 def errback(&b) @errbacks << b end |
#fail ⇒ Object
23 24 25 26 |
# File 'lib/sinatra/async/test.rb', line 23 def fail @errbacks.each { |cb| cb.call } @errbacks.clear end |
#succeed ⇒ Object
27 28 29 30 |
# File 'lib/sinatra/async/test.rb', line 27 def succeed @callbacks.each { |cb| cb.call } @callbacks.clear end |