Extend with a module instead of aliasing on the singleton class

This commit is contained in:
Jack Nagel 2014-06-25 11:19:00 -05:00
parent e24c5a750a
commit 51326e0b63

View File

@ -1151,15 +1151,14 @@ module Homebrew
end
def inject_dump_stats checks
class << checks
alias_method :oldsend, :send
def send method
checks.extend Module.new {
def send(method, *)
time = Time.now
oldsend(method)
super
ensure
$times[method] = Time.now - time
end
end
}
$times = {}
at_exit {
puts $times.sort_by{|k, v| v }.map{|k, v| "#{k}: #{v}"}