Class: Fastr::DeferrableResponse
- Inherits:
-
Object
- Object
- Fastr::DeferrableResponse
- Includes:
- EventMachine::Deferrable
- Defined in:
- lib/fastr/deferrable.rb
Instance Method Summary collapse
- #closed(&cb) ⇒ Object
- #each(&cb) ⇒ Object
- #finish ⇒ Object
- #send_data(data) ⇒ Object
- #task(operation, callback) ⇒ Object
Instance Method Details
#closed(&cb) ⇒ Object
26 27 28 |
# File 'lib/fastr/deferrable.rb', line 26 def closed(&cb) self.errback(&cb) end |
#each(&cb) ⇒ Object
34 35 36 |
# File 'lib/fastr/deferrable.rb', line 34 def each(&cb) @callback = cb end |
#finish ⇒ Object
30 31 32 |
# File 'lib/fastr/deferrable.rb', line 30 def finish self.succeed end |
#send_data(data) ⇒ Object
18 19 20 |
# File 'lib/fastr/deferrable.rb', line 18 def send_data(data) @callback.call(data) end |
#task(operation, callback) ⇒ Object
22 23 24 |
# File 'lib/fastr/deferrable.rb', line 22 def task(operation, callback) EM.defer(operation, callback) end |