Module: Kernel

Defined in:
lib/stack_tracy/core_ext/kernel.rb

Instance Method Summary collapse

Instance Method Details

#stack_tracy(arg = nil, options = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/stack_tracy/core_ext/kernel.rb', line 3

def stack_tracy(arg = nil, options = {})
  if arg.is_a?(Hash)
    options = arg
    arg = nil
  end
  StackTracy.start options
  yield
  StackTracy.stop
  if arg == :print
    StackTracy.print
  elsif arg == :dump
    StackTracy.dump
  elsif arg == :open
    StackTracy.dump do |file|
      StackTracy.open file, true, options
    end
  elsif arg.is_a? String
    StackTracy.dump arg
  end
  nil
end