Sha256: 5c83da9b479e4b70688975f8391a0ccfad1fb192bd840960791fa4f02b976ac8
Contents?: true
Size: 897 Bytes
Versions: 4
Compression:
Stored size: 897 Bytes
Contents
# Class that can subscribe to and log any view events module Footnotes class ViewSubscriber < ActiveSupport::LogSubscriber attr_accessor :events def initialize @events = Array.new super end def render_template(event) @events << event.dup end alias :render_partial :render_template alias :render_collection :render_template def partials events.select{ |e| e.name =~ /render_partial/ } end def partial_time partials.map{|p| p.duration }.sum end def page events.find{ |e| e.name =~ /render_template/ } end def view page && page.payload[:identifier] end def view_name view && view.gsub(Rails.root.join("app/views/").to_s, '') end def layout page && page.payload[:layout] end end def self.view_subscriber @view_subscriber ||= ViewSubscriber.new end end
Version data entries
4 entries across 4 versions & 1 rubygems