Sha256: 875c5548c36604345f5ac9e60bb338a71219f262902750fb856894ad5dafc357

Contents?: true

Size: 770 Bytes

Versions: 34

Compression:

Stored size: 770 Bytes

Contents

require 'active_support/core_ext/module/attr_internal'

module Scrivito

module ControllerRuntime
  extend ActiveSupport::Concern

protected

  attr_internal :rc_runtime

  def cleanup_view_runtime
    rc_rt_before_render = Scrivito::LogSubscriber.reset_runtime
    runtime = super
    rc_rt_after_render = Scrivito::LogSubscriber.reset_runtime
    self.rc_runtime = rc_rt_before_render + rc_rt_after_render
    runtime - rc_rt_after_render
  end

  def append_info_to_payload(payload)
    super
    payload[:rc_runtime] = rc_runtime
  end

  module ClassMethods
    def log_process_action(payload)
      messages, rc_runtime = super, payload[:rc_runtime]
      messages << ("Scrivito: %.1fms" % rc_runtime.to_f)
      messages
    end
  end
end

end # module Scrivito

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
scrivito_sdk-0.65.2 lib/scrivito/controller_runtime.rb
scrivito_sdk-0.65.1 lib/scrivito/controller_runtime.rb
scrivito_sdk-0.65.0 lib/scrivito/controller_runtime.rb
scrivito_sdk-0.65.0.rc2 lib/scrivito/controller_runtime.rb
scrivito_sdk-0.65.0.rc1 lib/scrivito/controller_runtime.rb
scrivito_sdk-0.60.0 lib/scrivito/controller_runtime.rb
scrivito_sdk-0.60.0.rc2 lib/scrivito/controller_runtime.rb
scrivito_sdk-0.50.1 lib/scrivito/controller_runtime.rb
scrivito_sdk-0.60.0.rc1 lib/scrivito/controller_runtime.rb
scrivito_sdk-0.50.0 lib/scrivito/controller_runtime.rb
scrivito_sdk-0.50.0.rc2 lib/scrivito/controller_runtime.rb
scrivito_sdk-0.50.0.rc1 lib/scrivito/controller_runtime.rb
scrivito_sdk-0.42.1 lib/scrivito/controller_runtime.rb
scrivito_sdk-0.42.1.rc3 lib/scrivito/controller_runtime.rb
scrivito_sdk-0.42.1.rc2 lib/scrivito/controller_runtime.rb
scrivito_sdk-0.42.1.rc1 lib/scrivito/controller_runtime.rb
scrivito_sdk-0.42.0 lib/scrivito/controller_runtime.rb
scrivito_sdk-0.41.1 lib/scrivito/controller_runtime.rb
scrivito_sdk-0.41.0 lib/scrivito/controller_runtime.rb
scrivito_sdk-0.41.0.rc2 lib/scrivito/controller_runtime.rb