Class: Rack::Events::EventedBodyProxy
- Defined in:
- lib/rack/events.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #call(stream) ⇒ Object
- #each ⇒ Object
-
#initialize(body, request, response, handlers, &block) ⇒ EventedBodyProxy
constructor
A new instance of EventedBodyProxy.
- #respond_to?(method_name, include_all = false) ⇒ Boolean
Methods inherited from BodyProxy
#close, #closed?, #method_missing, #respond_to_missing?
Constructor Details
#initialize(body, request, response, handlers, &block) ⇒ EventedBodyProxy
Returns a new instance of EventedBodyProxy.
83 84 85 86 87 88 |
# File 'lib/rack/events.rb', line 83 def initialize(body, request, response, handlers, &block) super(body, &block) @request = request @response = response @handlers = handlers end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Rack::BodyProxy
Instance Attribute Details
#request ⇒ Object (readonly)
Returns the value of attribute request.
81 82 83 |
# File 'lib/rack/events.rb', line 81 def request @request end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
81 82 83 |
# File 'lib/rack/events.rb', line 81 def response @response end |
Instance Method Details
#call(stream) ⇒ Object
95 96 97 98 |
# File 'lib/rack/events.rb', line 95 def call(stream) @handlers.reverse_each { |handler| handler.on_send request, response } super end |
#each ⇒ Object
90 91 92 93 |
# File 'lib/rack/events.rb', line 90 def each @handlers.reverse_each { |handler| handler.on_send request, response } super end |
#respond_to?(method_name, include_all = false) ⇒ Boolean
100 101 102 103 104 105 106 107 |
# File 'lib/rack/events.rb', line 100 def respond_to?(method_name, include_all = false) case method_name when :each, :call @body.respond_to?(method_name, include_all) else super end end |