Mega Code Archive

 
Categories / Ruby / Reflection
 

Get caller line number

def func1   puts caller[0] end def func2   func1 end func2              # Prints: somefile.rb:6:in 'func2'