Sha256: f340fabd201eadcfa642c3b440c5d400a644118b9a4f4458be379b3d6755e0be
Contents?: true
Size: 1.14 KB
Versions: 107
Compression:
Stored size: 1.14 KB
Contents
require 'active_support/core_ext/module/attr_internal' module Scrivito module ControllerRuntime extend ActiveSupport::Concern protected attr_internal :scrivito_runtime def process_action(action, *args) # We also need to reset the runtime before each action # because of queries in middleware or in cases we are streaming # and it won't be cleaned up by the method below. reset_scrivito_runtime super end def cleanup_view_runtime self.scrivito_runtime = reset_scrivito_runtime runtime = super scrivito_rt_after_render = reset_scrivito_runtime self.scrivito_runtime += scrivito_rt_after_render runtime - scrivito_rt_after_render end def append_info_to_payload(payload) super payload[:scrivito_runtime] = (self.scrivito_runtime || 0) + reset_scrivito_runtime end module ClassMethods def log_process_action(payload) messages, scrivito_runtime = super, payload[:scrivito_runtime] messages << ("Scrivito: %.1fms" % scrivito_runtime.to_f) messages end end def reset_scrivito_runtime Scrivito::LogSubscriber.reset_runtime end end end # module Scrivito
Version data entries
107 entries across 107 versions & 1 rubygems