Sha256: e88753d6b21be959e1e9521049aa6973e557662a7cd5a5e20e30582597099200

Contents?: true

Size: 950 Bytes

Versions: 3

Compression:

Stored size: 950 Bytes

Contents

::ActionView::TemplateRenderer.class_eval do
  alias_method :render_with_layout_without_tracebin, :render_with_layout

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

    if path
      if method(:find_layout).arity == 3
        layout = find_layout(path, locals.keys, [formats.first])
      else
        layout = find_layout(path, locals.keys)
      end
    end

    if layout
      start_time = ::Tracebin::PatchHelper.timestamp_string

      result = render_with_layout_without_tracebin(path, locals, *args, &block)

      end_time = ::Tracebin::PatchHelper.timestamp_string

      event_data = [
        'render_layout.action_view',
        start_time,
        end_time,
        {
          identifier: layout.identifier
        }
      ]

      ::Tracebin::Patches.handle_event :action_view_layout, event_data

      result
    else
      render_with_layout_without_tracebin(path, locals, *args, &block)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tracebin-0.0.13 lib/tracebin/patches/action_view_layout.rb
tracebin-0.0.12 lib/tracebin/patches/action_view_layout.rb
tracebin-0.0.11 lib/tracebin/patches/action_view_layout.rb