class ActionDispatch::Http::ContentDisposition
:nodoc:
def self.format(disposition:, filename:)
def self.format(disposition:, filename:) new(disposition: disposition, filename: filename).to_s end
def ascii_filename
def ascii_filename 'filename="' + percent_escape(I18n.transliterate(filename), TRADITIONAL_ESCAPED_CHAR) + '"' end
def initialize(disposition:, filename:)
def initialize(disposition:, filename:) @disposition = disposition @filename = filename end
def percent_escape(string, pattern)
def percent_escape(string, pattern) string.gsub(pattern) do |char| char.bytes.map { |byte| "%%%02X" % byte }.join end end
def to_s
def to_s if filename "#{disposition}; #{ascii_filename}; #{utf8_filename}" else "#{disposition}" end end
def utf8_filename
def utf8_filename "filename*=UTF-8''" + percent_escape(filename, RFC_5987_ESCAPED_CHAR) end