Class: ActionDispatch::Response::FileBody
Do not use. This class is for internal use only.
Relationships & Source Files | |
Inherits: | Object |
Defined in: | actionpack/lib/action_dispatch/http/response.rb |
Overview
Avoid having to pass an open file handle as the response body. Rack::Sendfile
will usually intercept the response and uses the path directly, so there is no reason to open the file.
Class Method Summary
- .new(path) ⇒ FileBody constructor
Instance Attribute Summary
- #to_path readonly
Instance Method Summary
Constructor Details
.new(path) ⇒ FileBody
# File 'actionpack/lib/action_dispatch/http/response.rb', line 355
def initialize(path) @to_path = path end
Instance Attribute Details
#to_path (readonly)
[ GitHub ]# File 'actionpack/lib/action_dispatch/http/response.rb', line 353
attr_reader :to_path
Instance Method Details
#body
[ GitHub ]#each
Stream the file’s contents if Rack::Sendfile
isn’t present.