Class: Hanami::Action::Rack::File Private
- Inherits:
-
Object
- Object
- Hanami::Action::Rack::File
- Defined in:
- lib/hanami/action/rack/file.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
File to be sent
Constant Summary collapse
- PATH_INFO =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
The key that returns path info from the Rack env
"PATH_INFO".freeze
Instance Method Summary collapse
- #call(env) ⇒ Object private
-
#initialize(path, root) ⇒ File
constructor
private
A new instance of File.
Constructor Details
#initialize(path, root) ⇒ File
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of File.
23 24 25 26 |
# File 'lib/hanami/action/rack/file.rb', line 23 def initialize(path, root) @file = ::Rack::File.new(root.to_s) @path = path.to_s end |
Instance Method Details
#call(env) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
30 31 32 33 34 35 36 37 |
# File 'lib/hanami/action/rack/file.rb', line 30 def call(env) env = env.dup env[PATH_INFO] = @path @file.get(env) rescue Errno::ENOENT [404, {}, nil] end |