Class: ActionDispatch::Response::FileBody
- 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.
Instance Attribute Summary collapse
-
#to_path ⇒ Object
readonly
Returns the value of attribute to_path.
Instance Method Summary collapse
- #body ⇒ Object
-
#each ⇒ Object
Stream the file’s contents if Rack::Sendfile isn’t present.
-
#initialize(path) ⇒ FileBody
constructor
A new instance of FileBody.
Constructor Details
#initialize(path) ⇒ FileBody
Returns a new instance of FileBody.
347 348 349 |
# File 'actionpack/lib/action_dispatch/http/response.rb', line 347 def initialize(path) @to_path = path end |
Instance Attribute Details
#to_path ⇒ Object (readonly)
Returns the value of attribute to_path
345 346 347 |
# File 'actionpack/lib/action_dispatch/http/response.rb', line 345 def to_path @to_path end |