Sha256: 28475db8705c6e1ccbe522cce1b07ba58a99ee957ce5d2411b1feaf7f7732449
Contents?: true
Size: 952 Bytes
Versions: 1
Compression:
Stored size: 952 Bytes
Contents
module Yarder module ActionView class LogSubscriber < ::ActiveSupport::LogSubscriber def render_template(event) render_entry = {} render_entry['identifier'] = from_rails_root(event.payload[:identifier]) render_entry['layout'] = from_rails_root(event.payload[:layout]) if event.payload[:layout] render_entry['duration'] = event.duration entry.fields['rendering'] ||= [] entry.fields['rendering'] << render_entry entry.fields['duration'] ||= {} entry.fields['duration']['rendering'] ||= 0 entry.fields['duration']['rendering'] += event.duration.to_f end alias :render_partial :render_template alias :render_collection :render_template private def from_rails_root(string) string.sub("#{Rails.root}/", "").sub(/^app\/views\//, "") end def entry Yarder.log_entries[Thread.current] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
yarder-0.1.0 | lib/yarder/action_view/log_subscriber.rb |