class Gitlab::FileResponse
Wrapper class of file response.
def empty?
-
(bool)
- Always false
def empty? false end
def initialize(file)
def initialize(file) @file = file end
def inspect
-
(String)
- Formatted string with the class name, object id and filename.
def inspect "#<#{self.class}:#{object_id} {filename: #{filename.inspect}}>" end
def method_missing(name, *args, &block)
def method_missing(name, *args, &block) if @file.respond_to?(name) @file.send(name, *args, &block) else super end end
def parse_headers!(headers)
def parse_headers!(headers) @filename = headers[HEADER_CONTENT_DISPOSITION].split('filename=')[1] @filename = @filename[1...-1] if @filename[0] == '"' # Unquote filenames end
def respond_to_missing?(method_name, include_private = false)
def respond_to_missing?(method_name, include_private = false) super || @file.respond_to?(method_name, include_private) end
def to_hash
-
(Hash)
- A hash consisting of filename and io object
def to_hash { filename: @filename, data: @file } end