Class: Rack::Signals::BodyWithCallback
- Inherits:
-
Object
- Object
- Rack::Signals::BodyWithCallback
- Defined in:
- lib/rack/contrib/signals.rb
Instance Method Summary collapse
- #close ⇒ Object
- #each(&block) ⇒ Object
-
#initialize(body, callback) ⇒ BodyWithCallback
constructor
A new instance of BodyWithCallback.
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
#close ⇒ Object
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 |