Sha256: 03da1ba18128a02d64cf72528ccb16e38c483df72a45868668164459fbc80eb0
Contents?: true
Size: 797 Bytes
Versions: 1
Compression:
Stored size: 797 Bytes
Contents
# alias old_puts puts # def puts(*args) # return if args.empty? # old_puts (['[', caller[0].inspect, ' -- ', *args] << ']').join # end # # alias old_p p # def p(*args) # args.map! {|a| a.inspect } # old_puts (['[', caller[0].inspect, ' -- ', *args] << ']').join # end ## def show_caller_for(meth, lines, new_meth="__#{meth}__") lines = [*lines] alias_method "#{new_meth}".to_sym, meth self.class_eval(<<-HELP) def #{meth}(*args, &block) #{lines.join("\n")} #{new_meth}(*args, &block) end HELP end $hash = Hash.new {|h, k| h[k] = 0 } # Kernel.module_eval do # # show_caller_for :catch, "$hash[caller[0]] += 1" # # show_caller_for :throw, "$hash[caller[0]] += 1" # end if ENV["TESTING"] == "true" END { require 'pp' puts $hash.sort.inspect if $hash.any? } end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
amp-0.5.3 | lib/amp/profiling_hacks.rb |