Sha256: 2dc9676c24e2a6e84013f4a64f67a169be8905b85bc8e9b69675e15d24fe32e2
Contents?: true
Size: 753 Bytes
Versions: 4
Compression:
Stored size: 753 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 } # # String.class_eval do # show_caller_for :split_newlines, "$hash[caller[0]] += 1" # end if ENV["TESTING"] == "true" END { require 'pp' STDERR.puts $hash.inspect if $hash.any? } end
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
amp-0.5.2 | lib/amp/profiling_hacks.rb |
amp-0.5.1 | lib/amp/profiling_hacks.rb |
amp-pure-0.5.0 | lib/amp/profiling_hacks.rb |
amp-0.5.0 | lib/amp/profiling_hacks.rb |