Get caller line number : caller « Reflection « Ruby






Get caller line number


def func1
  puts caller[0]
end

def func2
  func1
end

func2              # Prints: somefile.rb:6:in 'func2'

 








Related examples in the same category

1.Generating and Understanding Tracebacks