class Grape::ServeFile::FileBody
Class helps send file through API
Attributes
path[R]
Public Class Methods
new(path)
click to toggle source
@param path [String]
# File lib/grape/serve_file/file_body.rb, line 10 def initialize(path) @path = path end
Public Instance Methods
==(other)
click to toggle source
# File lib/grape/serve_file/file_body.rb, line 29 def ==(other) path == other.path end
each() { |chunk| ... }
click to toggle source
# File lib/grape/serve_file/file_body.rb, line 21 def each File.open(path, 'rb') do |file| while (chunk = file.read(CHUNK_SIZE)) yield chunk end end end
to_path()
click to toggle source
Need for Rack::Sendfile middleware
@return [String]
# File lib/grape/serve_file/file_body.rb, line 17 def to_path path end