Sha256: d207be4cb5793d4bd3e340eae7a3977db462f698650fb641a863710781913b31
Contents?: true
Size: 516 Bytes
Versions: 3
Compression:
Stored size: 516 Bytes
Contents
module Kernel # Like #warn produces the current line number as well. # # require 'facet/kernel/warn_with_line' # # warn_with_line("You have been warned.") # # _produces_ # # 3: Warning: You have been warned. # # Note that this method depends on the output of #caller. def warn_with_line(msg="", fulltrace=nil) trace = caller(1) where = trace[0].sub(/:in.*/,'') STDERR.puts "#{where}: Warning: #{msg}" STDERR.puts trace.map { |t| "\tfrom #{t}" } if fulltrace end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
facets-0.7.0 | lib/facet/kernel/warn_with_line.rb |
facets-0.7.1 | lib/facet/kernel/warn_with_line.rb |
facets-0.7.2 | lib/facet/kernel/warn_with_line.rb |