Sha256: 9cccc704d199554bfb65fa04037fe76049f3b1f795688d0366b783abb49b8e4d

Contents?: true

Size: 1.04 KB

Versions: 20

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

module Skylight
  module Probes
    module ActionView
      module Instrumentation
        def render_with_layout(*args) #:nodoc:
          path, locals =
            case args.length
            when 2
              args
            when 4
              # Rails > 6.0.0.beta3 arguments are (view, template, path, locals)
              [args[2], args[3]]
            end

          layout = nil

          layout = find_layout(path, locals.keys, [formats.first]) if path

          if layout
            ActiveSupport::Notifications.instrument("render_template.action_view", identifier: layout.identifier) do
              super
            end
          else
            super
          end
        end
      end

      class Probe
        def install
          return if ::ActionView.gem_version >= Gem::Version.new("6.1.0.alpha")

          ::ActionView::TemplateRenderer.prepend(Instrumentation)
        end
      end
    end

    register(:action_view, "ActionView::TemplateRenderer", "action_view", ActionView::Probe.new)
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

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