Extend with a module instead of aliasing on the singleton class
This commit is contained in:
parent
e24c5a750a
commit
51326e0b63
@ -1151,15 +1151,14 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def inject_dump_stats checks
|
def inject_dump_stats checks
|
||||||
class << checks
|
checks.extend Module.new {
|
||||||
alias_method :oldsend, :send
|
def send(method, *)
|
||||||
def send method
|
|
||||||
time = Time.now
|
time = Time.now
|
||||||
oldsend(method)
|
super
|
||||||
ensure
|
ensure
|
||||||
$times[method] = Time.now - time
|
$times[method] = Time.now - time
|
||||||
end
|
end
|
||||||
end
|
}
|
||||||
$times = {}
|
$times = {}
|
||||||
at_exit {
|
at_exit {
|
||||||
puts $times.sort_by{|k, v| v }.map{|k, v| "#{k}: #{v}"}
|
puts $times.sort_by{|k, v| v }.map{|k, v| "#{k}: #{v}"}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user