Module: Deployable::Debug

Defined in:
lib/deployable/debug.rb,
lib/deployable/debug/version.rb

Defined Under Namespace

Modules: Id

Constant Summary collapse

VERSION =
"0.1.1"

Instance Method Summary collapse

Instance Method Details

#debug(*vals) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/deployable/debug.rb', line 12

def debug *vals
  return unless $debug
  if block_given?  
    yield  
  else
    #text = vals[0]
    log 'debug', *vals
  end
end

#log(*vals) ⇒ Object



32
33
34
35
36
37
38
39
40
41
# File 'lib/deployable/debug.rb', line 32

def log *vals
  binding.pry
  str = ''
  if vals.length == 1
    vals[1] = ''
  elsif vals.length > 2 
    str = vals[2..-1].join('] [')
  end
  printf "%-5s: %s [%s]\n", vals[0], vals[1], str
end

#trace(*vals) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'lib/deployable/debug.rb', line 22

def trace *vals
  return unless $trace
  if block_given?
    yield  
  else
    #log 'trace', text, vals[1..-1].join('] [')
    log 'trace', *vals
  end  
end