# # # # # # # # #
# /36/oo.rb
#
# by Jan Lelis
# e-mail: mail@janlelis.de
# type/version: ruby
# snippet url: http://rbJL.net/36/oo.rb
# original post: http://rbJL.net/36-little-heplers-for-ruby-print-debugging
# license: CC-BY (DE)
#
# (c) 2010 Jan Lelis.
### usage
# o
# o:Label
### example outputs
# Reached method `irb_binding', line 1 of file (irb)
# Reached method `abc', line 4 of file 123.rb
# Label: reached method `de', line 9 of file example.rb
def o(desc = nil)
caller[0].rindex( /:(\d+)(:in (`.*'))?$/ )
m = $3 ? "method #$3, " : ""
d = desc ? "#{desc}: r" : 'R'
# lol, I need to change the syntax highlighter...
# the "syntax" gem *crashed* when I wrote "#$`"
puts "#{d}eached #{m}line #{$1} of file #{$`}"
end
alias oo o