Class: Rack::Signals::BodyWithCallback

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/contrib/signals.rb

Instance Method Summary collapse

Constructor Details

#initialize(body, callback) ⇒ BodyWithCallback

Returns a new instance of BodyWithCallback.



21
22
23
# File 'lib/rack/contrib/signals.rb', line 21

def initialize(body, callback)
  @body, @callback = body, callback
end

Instance Method Details

#closeObject



30
31
32
# File 'lib/rack/contrib/signals.rb', line 30

def close
  @body.close if @body.respond_to?(:close)
end

#each(&block) ⇒ Object



25
26
27
28
# File 'lib/rack/contrib/signals.rb', line 25

def each(&block)
  @body.each(&block)
  @callback.call
end