module Carver
Constants
- VERSION
Attributes
configuration[W]
Public Class Methods
add_to_results(key, results)
click to toggle source
# File lib/carver.rb, line 26 def self.add_to_results(key, results) if current_results[key].nil? current_results[key] = [results] else current_results[key] << results end end
clear_results()
click to toggle source
# File lib/carver.rb, line 34 def self.clear_results @current_results = {} end
configuration()
click to toggle source
# File lib/carver.rb, line 14 def self.configuration @configuration ||= Configuration.new end
configure() { |configuration| ... }
click to toggle source
# File lib/carver.rb, line 18 def self.configure yield(configuration) end
current_results()
click to toggle source
# File lib/carver.rb, line 22 def self.current_results @current_results ||= {} end
define_around_action()
click to toggle source
# File lib/carver.rb, line 46 def self.define_around_action Rails.send(:load, "#{Rails.root}/app/controllers/application_controller.rb") return if ApplicationController.instance_methods(false).include?(:profile_controller_actions) ApplicationController.class_eval do around_action :profile_controller_actions def profile_controller_actions Carver::Profiler.profile_memory(controller_path, action_name, 'ApplicationController') do yield end end end rescue LoadError, NameError raise 'ApplicationController not defined' end
define_around_perform() { || ... }
click to toggle source
# File lib/carver.rb, line 63 def self.define_around_perform Rails.send(:load, "#{Rails.root}/app/jobs/application_job.rb") ApplicationJob.class_eval do around_perform do |job| Carver::Profiler.profile_memory(job.name, 'perform', 'ApplicationJob') do yield end end end rescue LoadError, NameError raise 'ApplicationJob not defined' end
start()
click to toggle source
# File lib/carver.rb, line 38 def self.start configuration.enabled = true end
stop()
click to toggle source
# File lib/carver.rb, line 42 def self.stop configuration.enabled = false end
Public Instance Methods
profile_controller_actions() { || ... }
click to toggle source
# File lib/carver.rb, line 53 def profile_controller_actions Carver::Profiler.profile_memory(controller_path, action_name, 'ApplicationController') do yield end end