Class: Lotus::Action::Rack::File Private

Inherits:
Object
  • Object
show all
Defined in:
lib/lotus/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

See Also:

  • #send_file

Since:

  • 0.4.3

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ 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.

Parameters:

  • path (String, Pathname)

    file path

Since:

  • 0.4.3



17
18
19
20
# File 'lib/lotus/action/rack/file.rb', line 17

def initialize(path)
  @file = ::Rack::File.new(nil)
  @path = path
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.

Since:

  • 0.4.3



24
25
26
27
28
29
# File 'lib/lotus/action/rack/file.rb', line 24

def call(env)
  @file.path = @path.to_s
  @file.serving(env)
rescue Errno::ENOENT
  [404, {}, nil]
end