Sha256: e2008381c440154bf322fd0b6afa5d5e0f897a4c0ef05323ea20d12fdb285742

Contents?: true

Size: 1.21 KB

Versions: 8

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

8 entries across 8 versions & 1 rubygems

Version Path
skylight-5.1.0.beta lib/skylight/normalizers/action_controller/send_file.rb
skylight-5.0.1 lib/skylight/normalizers/action_controller/send_file.rb
skylight-5.0.0 lib/skylight/normalizers/action_controller/send_file.rb
skylight-5.0.0.beta5 lib/skylight/normalizers/action_controller/send_file.rb
skylight-5.0.0.beta4 lib/skylight/normalizers/action_controller/send_file.rb
skylight-5.0.0.beta3 lib/skylight/normalizers/action_controller/send_file.rb
skylight-5.0.0.beta2 lib/skylight/normalizers/action_controller/send_file.rb
skylight-5.0.0.beta lib/skylight/normalizers/action_controller/send_file.rb