# # # # # # # # #
# /36/cc.rb
#
# by               Jan Lelis
# e-mail:          mail@janlelis.de
# type/version:    ruby 1.9
# snippet url:     http://rbJL.net/36/cc.rb
# original post:   http://rbJL.net/36-little-heplers-for-ruby-print-debugging
# license:         CC-BY (DE)
#
# (c) 2010 Jan Lelis.

### usage
# def qwe
#  c
# end
#
# def rtz
#   qwe
# end
#
# rtz
#
### example output
# <main>
#   rtz
#     qwe


def c
  puts caller.reverse.map.with_index{ |m, i|
    m.rindex( /:\d+(:in `(.*)')?$/ )
    "  "*i + $2
  }
end
alias cc c

# The version in Zucker also filters irb methods