Class: Fastr::DeferrableResponse

Inherits:
Object
  • Object
show all
Includes:
EventMachine::Deferrable
Defined in:
lib/fastr/deferrable.rb

Instance Method Summary collapse

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

#finishObject



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