Class: ActionDispatch::Response::RackBody
- Inherits:
-
Object
- Object
- ActionDispatch::Response::RackBody
- Defined in:
- lib/action_dispatch/http/response.rb
Constant Summary collapse
- BODY_METHODS =
{ to_ary: true, each: true, call: true, to_path: true }
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #body ⇒ Object
- #call(*arguments, &block) ⇒ Object
- #close ⇒ Object
- #each(*args, &block) ⇒ Object
-
#initialize(response) ⇒ RackBody
constructor
A new instance of RackBody.
- #respond_to?(method, include_private = false) ⇒ Boolean
- #to_ary ⇒ Object
- #to_path ⇒ Object
Constructor Details
#initialize(response) ⇒ RackBody
Returns a new instance of RackBody.
531 532 533 |
# File 'lib/action_dispatch/http/response.rb', line 531 def initialize(response) @response = response end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
535 536 537 |
# File 'lib/action_dispatch/http/response.rb', line 535 def response @response end |
Instance Method Details
#body ⇒ Object
543 544 545 |
# File 'lib/action_dispatch/http/response.rb', line 543 def body @response.body end |
#call(*arguments, &block) ⇒ Object
565 566 567 |
# File 'lib/action_dispatch/http/response.rb', line 565 def call(*arguments, &block) @response.stream.call(*arguments, &block) end |
#close ⇒ Object
537 538 539 540 541 |
# File 'lib/action_dispatch/http/response.rb', line 537 def close # Rack "close" maps to Response#abort, and **not** Response#close (which is used # when the controller's finished writing) @response.abort end |
#each(*args, &block) ⇒ Object
561 562 563 |
# File 'lib/action_dispatch/http/response.rb', line 561 def each(*args, &block) @response.each(*args, &block) end |
#respond_to?(method, include_private = false) ⇒ Boolean
549 550 551 552 553 554 555 |
# File 'lib/action_dispatch/http/response.rb', line 549 def respond_to?(method, include_private = false) if BODY_METHODS.key?(method) @response.stream.respond_to?(method) else super end end |
#to_ary ⇒ Object
557 558 559 |
# File 'lib/action_dispatch/http/response.rb', line 557 def to_ary @response.stream.to_ary end |
#to_path ⇒ Object
569 570 571 |
# File 'lib/action_dispatch/http/response.rb', line 569 def to_path @response.stream.to_path end |