Sha256: 9425b25e1ef11718bef4d5eef30fbe42d6cc9c78bd123d769e89b2f215e71b08
Contents?: true
Size: 1.02 KB
Versions: 2
Compression:
Stored size: 1.02 KB
Contents
require "action_dispatch/http/mime_type" require "action_dispatch/http/mime_types" require "rack/utils" module Skylight module Normalize class SendFile < Normalizer register "send_file.action_controller" def normalize path = @payload[:path] annotations = { path: path, filename: @payload[:filename], type: normalize_type, disposition: normalize_disposition, status: normalize_status } # These will eventually be different title = desc = "send file: #{path}" [ "app.controller.send_file", title, desc, annotations ] end private def normalize_type type = @payload[:type] || "application/octet-stream" type = Mime[type].to_s if type.is_a?(Symbol) type end def normalize_status status = @payload[:status] || 200 Rack::Utils.status_code(status) end def normalize_disposition @payload[:disposition] || "attachment" end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
skylight-0.0.10 | lib/skylight/normalize/send_file.rb |
skylight-0.0.7 | lib/skylight/normalize/send_file.rb |