class Gitlab::FileResponse
Wrapper class of file response.
Constants
- HEADER_CONTENT_DISPOSITION
Attributes
Public Class Methods
Public Instance Methods
Source
# File lib/gitlab/file_response.rb, line 15 def empty? false end
@return [bool] Always false
Source
# File lib/gitlab/file_response.rb, line 26 def inspect "#<#{self.class}:#{object_id} {filename: #{filename.inspect}}>" end
@return [String] Formatted string with the class name, object id and filename.
Source
# File lib/gitlab/file_response.rb, line 30 def method_missing(name, *args, &block) if @file.respond_to?(name) @file.send(name, *args, &block) else super end end
Calls superclass method
Source
# File lib/gitlab/file_response.rb, line 43 def parse_headers!(headers) @filename = headers[HEADER_CONTENT_DISPOSITION].split('filename=')[1] @filename = @filename[1...-1] if @filename[0] == '"' # Unquote filenames end
Parse filename from the ‘Content Disposition’ header.
Source
# File lib/gitlab/file_response.rb, line 38 def respond_to_missing?(method_name, include_private = false) super || @file.respond_to?(method_name, include_private) end
Calls superclass method
Source
# File lib/gitlab/file_response.rb, line 20 def to_hash { filename: @filename, data: @file } end
@return [Hash] A hash consisting of filename and io object
Also aliased as: to_h