module QP

Copyright (C) 2003-2020 Koichiro Eto, All rights reserved. License: MIT License

Constants

VERSION

Public Class Methods

ar_inspect(ar) click to toggle source
# File lib/qp.rb, line 13
def ar_inspect(ar)
  '['+ar.map {|arg| arg.inspect }.join(', ')+']'
end
caller_msg(ca) click to toggle source
# File lib/qp.rb, line 7
def caller_msg(ca)
  file, linenum, msg = ca.first.split(/:([0-9]+):/)
  msg = $1 if /\Ain \`(.+)\'\z/ =~ msg
  File.basename(file)+':'+linenum.to_s+':'+msg.to_s
end
qp(ca, *args) click to toggle source
# File lib/qp.rb, line 22
def qp(ca, *args)
  QP.caller_msg(ca)+"\t"+QP.ar_inspect(args)
end
runtime() click to toggle source
# File lib/qp.rb, line 17
def runtime
  $__qp_t__ = Time.now unless defined? $__qp_t__
  sprintf('%.1f', Time.now - $__qp_t__)
end
tp(ca, *args) click to toggle source
# File lib/qp.rb, line 26
def tp(ca, *args)
  QP.runtime+':'+QP.qp(ca, *args)
end

Private Instance Methods

ar_inspect(ar) click to toggle source
# File lib/qp.rb, line 13
def ar_inspect(ar)
  '['+ar.map {|arg| arg.inspect }.join(', ')+']'
end
caller_msg(ca) click to toggle source
# File lib/qp.rb, line 7
def caller_msg(ca)
  file, linenum, msg = ca.first.split(/:([0-9]+):/)
  msg = $1 if /\Ain \`(.+)\'\z/ =~ msg
  File.basename(file)+':'+linenum.to_s+':'+msg.to_s
end
qp(ca, *args) click to toggle source
# File lib/qp.rb, line 22
def qp(ca, *args)
  QP.caller_msg(ca)+"\t"+QP.ar_inspect(args)
end
runtime() click to toggle source
# File lib/qp.rb, line 17
def runtime
  $__qp_t__ = Time.now unless defined? $__qp_t__
  sprintf('%.1f', Time.now - $__qp_t__)
end
tp(ca, *args) click to toggle source
# File lib/qp.rb, line 26
def tp(ca, *args)
  QP.runtime+':'+QP.qp(ca, *args)
end