Module: QP

Defined in:
lib/qp.rb,
lib/qp/version.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

:nodoc:



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

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

.caller_msg(ca) ⇒ Object

:nodoc:



7
8
9
10
11
# File 'lib/qp.rb', line 7

def caller_msg(ca) #:nodoc:
  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



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

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

.runtimeObject

:nodoc:



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

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

.tp(ca, *args) ⇒ Object



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

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