Module: QP

Defined in:
lib/qp.rb

Overview

Copyright © 2003-2007 Kouichirou Eto, All rights reserved. License: Ruby License

Defined Under Namespace

Modules: VERSION

Class Method Summary collapse

Class Method Details

.ar_inspect(ar) ⇒ Object



18
19
20
# File 'lib/qp.rb', line 18

def ar_inspect(ar)
  '['+ar.map {|arg| arg.inspect }.join(', ')+']'
end

.caller_msg(ca) ⇒ Object



12
13
14
15
16
# File 'lib/qp.rb', line 12

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) ⇒ Object



27
28
29
# File 'lib/qp.rb', line 27

def qp(ca, *args)
  QP.caller_msg(ca)+"\t"+QP.ar_inspect(args)
end

.runtimeObject



22
23
24
25
# File 'lib/qp.rb', line 22

def runtime
  $__qp_t__ = Time.now unless defined? $__qp_t__
  sprintf('%.1f', Time.now - $__qp_t__)
end

.tp(ca, *args) ⇒ Object



31
32
33
# File 'lib/qp.rb', line 31

def tp(ca, *args)
  QP.runtime+':'+QP.qp(ca, *args)
end