module SpeedGun

Constants

VERSION

Public Class Methods

config() click to toggle source

@return [SpeedGun::Config]

# File lib/speed_gun.rb, line 18
def config
  @config ||= SpeedGun::Config.new
end
configure() { |config| ... } click to toggle source

@yield [config] Configure speed gun @yieldparam config [SpeedGun::Config]

# File lib/speed_gun.rb, line 24
def configure
  yield config
end
current_report() click to toggle source

@return [SpeedGun::Report, nil]

# File lib/speed_gun.rb, line 29
def current_report
  Thread.current[:speed_gun_report]
end
current_report=(report) click to toggle source
# File lib/speed_gun.rb, line 33
def current_report=(report)
  Thread.current[:speed_gun_report] = report
end
get_backtrace(backtrace = caller(2)) click to toggle source
# File lib/speed_gun.rb, line 45
def get_backtrace(backtrace = caller(2))
  backtrace = Rails.backtrace_cleaner.clean(backtrace) if defined?(Rails)

  backtrace.map do |called|
    filename, line, trace = *called.split(':', 3)
    filename = File.expand_path(filename)
    [filename, line.to_i, trace]
  end
end
get_report(id) click to toggle source
# File lib/speed_gun.rb, line 41
def get_report(id)
  config.store.load("SpeedGun::Report/#{id}")
end
hook(name, &block) click to toggle source
# File lib/speed_gun/hook.rb, line 45
def self.hook(name, &block)
  SpeedGun::Hook.new(name, &block)
end
record(event) click to toggle source
# File lib/speed_gun.rb, line 37
def record(event)
  current_report && current_report.record(event)
end
version() click to toggle source

@return [Semantic::Version] Version

# File lib/speed_gun.rb, line 13
def version
  @version ||= Semantic::Version.new(VERSION)
end