Sha256: 94c25aa932f338aee60313408101c87420adec880bbd92e5c88c4ef8857c9aa8

Contents?: true

Size: 1.21 KB

Versions: 20

Compression:

Stored size: 1.21 KB

Contents

module Skylight
  module Normalizers
    module ActionController
      enabled = true

      # Temporary hacks
      begin
        require "action_dispatch/http/mime_type"
        require "action_dispatch/http/mime_types"
        require "rack/utils"
      rescue LoadError
        enabled = false
      end

      if enabled
        class SendFile < Normalizer
          register "send_file.action_controller"

          CAT = "app.controller.send_file".freeze
          TITLE = "send file".freeze

          def normalize(_trace, _name, _payload)
            title = TITLE

            # depending on normalization, we probably want this to eventually
            # include the full path, but we need to make sure we have a good
            # deduping strategy first.
            desc = nil

            [CAT, title, desc]
          end

          private

          OCTET_STREAM = "application/octet-stream".freeze
          ATTACHMENT = "attachment".freeze

          def initialize(*)
            super

            @mimes =
              Mime::SET.each_with_object({}) do |mime, hash|
                hash[mime.symbol] = mime.to_s.dup.freeze
                hash
              end
          end
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
skylight-6.1.0.beta lib/skylight/normalizers/action_controller/send_file.rb
skylight-6.0.4 lib/skylight/normalizers/action_controller/send_file.rb
skylight-6.0.3 lib/skylight/normalizers/action_controller/send_file.rb
skylight-5.3.5 lib/skylight/normalizers/action_controller/send_file.rb
skylight-6.0.2 lib/skylight/normalizers/action_controller/send_file.rb
skylight-6.0.1 lib/skylight/normalizers/action_controller/send_file.rb
skylight-6.0.0 lib/skylight/normalizers/action_controller/send_file.rb
skylight-6.0.0.beta2 lib/skylight/normalizers/action_controller/send_file.rb
skylight-6.0.0.beta lib/skylight/normalizers/action_controller/send_file.rb
skylight-5.3.4 lib/skylight/normalizers/action_controller/send_file.rb
skylight-5.3.3 lib/skylight/normalizers/action_controller/send_file.rb
skylight-5.3.2 lib/skylight/normalizers/action_controller/send_file.rb
skylight-5.3.1 lib/skylight/normalizers/action_controller/send_file.rb
skylight-5.3.0 lib/skylight/normalizers/action_controller/send_file.rb
skylight-5.2.0 lib/skylight/normalizers/action_controller/send_file.rb
skylight-5.2.0.beta2 lib/skylight/normalizers/action_controller/send_file.rb
skylight-5.2.0.beta lib/skylight/normalizers/action_controller/send_file.rb
skylight-5.1.1 lib/skylight/normalizers/action_controller/send_file.rb
skylight-5.1.0.beta3 lib/skylight/normalizers/action_controller/send_file.rb
skylight-5.1.0.beta2 lib/skylight/normalizers/action_controller/send_file.rb