Class: Thin::DeferrableBody

Inherits:
Object
  • Object
show all
Includes:
EM::Deferrable
Defined in:
lib/message_bus/rack/thin_ext.rb

Overview

Based on version from James Tucker <[email protected]>

Instance Method Summary collapse

Constructor Details

#initializeDeferrableBody

Returns a new instance of DeferrableBody.



10
11
12
13
# File 'lib/message_bus/rack/thin_ext.rb', line 10

def initialize
  @queue = []
  @body_callback = nil
end

Instance Method Details

#call(body) ⇒ Object



15
16
17
18
# File 'lib/message_bus/rack/thin_ext.rb', line 15

def call(body)
  @queue << body
  schedule_dequeue
end

#each(&blk) ⇒ Object



20
21
22
23
# File 'lib/message_bus/rack/thin_ext.rb', line 20

def each(&blk)
  @body_callback = blk
  schedule_dequeue
end