Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 19 lines (17 sloc) 478 Bytes
module Kernel
def warning(msg)
(
(defined? $Debug) && $Debug or
(defined? $DEBUG) && $DEBUG or
(defined? $VERBOSE) && $VERBOSE
) or return
#emit each warning only once
@@seenit__||={}
clr=caller[0]
callerid,mname=clr.match(/^(.*:[0-9]+)(?::in (.*))?$/)[1..2]
mname=mname[1..-2] if /^`.*'$/===mname
@@seenit__[callerid] and return
@@seenit__[callerid]=1
warn [callerid,": warning: (",mname,") ",msg].to_s
end
end