Class: Skylight::Core::Probes::ActionView::Probe Private

Inherits:
Object
  • Object
show all
Defined in:
lib/skylight/core/probes/action_view.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Instance Method Details

#installObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/skylight/core/probes/action_view.rb', line 5

def install
  ::ActionView::TemplateRenderer.class_eval do
    alias render_with_layout_without_sk render_with_layout

    def render_with_layout(path, locals, *args, &block) #:nodoc:
      layout = nil

      if path
        if ::ActionView.gem_version >= Gem::Version.new('5.x')
          layout = find_layout(path, locals.keys, [formats.first])
        else
          layout = find_layout(path, locals.keys)
        end
      end

      if layout
        instrument(:template, :identifier => layout.identifier) do
          render_with_layout_without_sk(path, locals, *args, &block)
        end
      else
        render_with_layout_without_sk(path, locals, *args, &block)
      end
    end
  end
end