Module: MethodTrace

Defined in:
lib/method-trace.rb

Class Method Summary collapse

Class Method Details

.method_trace(color = :green, depth = 1) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/method-trace.rb', line 4

def MethodTrace.method_trace(color = :green, depth = 1)
  cur_depth = 1
  prefix = "  "
  caller_locations(1, depth).each do |frame|
    puts Rainbow("#{prefix * cur_depth}#{cur_depth}:  #{frame.label} - #{frame}").color(color)
    cur_depth += 1
  end
end